X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Farc.cpp;h=e4a6b6f4788de7b89f1196fa75a8018217fad421;hb=c58b8a9f8b1ae5494857fc423ed8e33b2bbcf329;hp=9848d38a80e5272dc45ceb52c2963e80a08e4a6f;hpb=143b369c0308a8cd524cb0ed51c5d67d6be69603;p=architektonas diff --git a/src/arc.cpp b/src/arc.cpp index 9848d38..e4a6b6f 100644 --- a/src/arc.cpp +++ b/src/arc.cpp @@ -16,6 +16,7 @@ #include "arc.h" #include +#include "geometry.h" #include "mathconstants.h" #include "painter.h" @@ -151,6 +152,10 @@ Also: should put the snap logic into the Object base class (as a static method). /*virtual*/ bool Arc::Collided(Vector point) { + // Someone told us to fuck off, so we'll fuck off. :-) + if (ignoreClicks) + return false; + objectWasDragged = false; bool hitSomething = HitTest(point); draggingCenter = hitCenter; @@ -431,7 +436,7 @@ bool Arc::HitStateChanged(void) /*virtual*/ void Arc::Enumerate(FILE * file) { - fprintf(file, "ARC (%lf,%lf) %lf, %lf, %lf\n", position.x, position.y, radius, startAngle, angleSpan); + fprintf(file, "ARC %i (%lf,%lf) %lf, %lf, %lf\n", layer, position.x, position.y, radius, startAngle, angleSpan); } @@ -450,3 +455,45 @@ same reference number. return new Arc(position, radius, startAngle, angleSpan, parent); } + +/*virtual*/ void Arc::Rotate(Point point, double angle) +{ + Point c1 = Geometry::RotatePointAroundPoint(position, point, angle); + Point ap1(cos(startAngle), sin(startAngle)); + Point angleStartPoint = (ap1 * radius) + position; + Point c2 = Geometry::RotatePointAroundPoint(angleStartPoint, point, angle); + + position = c1; + startAngle = Vector(c2, c1).Angle(); +} + + +/*virtual*/ void Arc::Mirror(Point p1, Point p2) +{ + Point c1 = Geometry::MirrorPointAroundLine(position, p1, p2); + Point ap1(cos(startAngle + angleSpan), sin(startAngle + angleSpan)); + Point angleEndPoint = (ap1 * radius) + position; + Point c2 = Geometry::MirrorPointAroundLine(angleEndPoint, p1, p2); + + position = c1; + startAngle = Vector(c2, c1).Angle(); +} + + +/*virtual*/ void Arc::Save(void) +{ + Object::Save(); + oldRadius2 = radius; + oldStartAngle = startAngle; + oldAngleSpan = angleSpan; +} + + +/*virtual*/ void Arc::Restore(void) +{ + Object::Restore(); + radius = oldRadius2; + startAngle = oldStartAngle; + angleSpan = oldAngleSpan; +} +