X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fgeometry.cpp;h=5f9a30b964f07348db24af44482508c52bacf668;hb=c58b8a9f8b1ae5494857fc423ed8e33b2bbcf329;hp=fdceb8eff6a332f618f83b2a334e6c38a84a4323;hpb=4b37ccbdf263a4798e53a62e33d869a728ace283;p=architektonas diff --git a/src/geometry.cpp b/src/geometry.cpp index fdceb8e..5f9a30b 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -14,7 +14,7 @@ // #include "geometry.h" - +#include Point Geometry::IntersectionOfLineAndLine(Point p1, Point p2, Point p3, Point p4) { @@ -76,3 +76,13 @@ Point Geometry::MirrorPointAroundLine(Point point, Point p1, Point p2) return mirroredPoint; } + +Point Geometry::RotatePointAroundPoint(Point point, Point rotationPoint, double angle) +{ + Vector v = Vector(point, rotationPoint); + double px = (v.x * cos(angle)) - (v.y * sin(angle)); + double py = (v.x * sin(angle)) + (v.y * cos(angle)); + + return Vector(rotationPoint.x + px, rotationPoint.y + py, 0); +} +