X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fstructs.cpp;fp=src%2Fstructs.cpp;h=883e934e20e0d5629b7f664649721ecd8fbdf78f;hb=dacd9dc2c1ac093e4945f7befaeb5ff1801a0f52;hp=b731fae75a767c99d05962e639190ff863875caa;hpb=10cf4c797bed05831e976068b7504908279dc997;p=architektonas diff --git a/src/structs.cpp b/src/structs.cpp index b731fae..883e934 100644 --- a/src/structs.cpp +++ b/src/structs.cpp @@ -97,9 +97,30 @@ Arc::Arc(): type(OTArc), id(Global::objectID++) { } -Arc::Arc(Vector pt1, double r, double a1, double a2, float th/*= 1.0*/, uint32_t c/*= 0*/, int l/*= LSSolid*/): type(OTArc), id(Global::objectID++), layer(0), color(c), thickness(th), style(l), selected(false), hovered(false), hitObject(false) +Arc::Arc(Vector ctr, double r, double a1, double a2, float th/*= 1.0*/, uint32_t c/*= 0*/, int l/*= LSSolid*/): type(OTArc), id(Global::objectID++), layer(0), color(c), thickness(th), style(l), selected(false), hovered(false), hitObject(false) { - p[0] = pt1; radius[0] = r; angle[0] = a1, angle[1] = a2; hitPoint[0] = hitPoint[1] = hitPoint[2] = false; + p[0] = ctr; + radius[0] = r; + angle[0] = a1; + angle[1] = a2; + hitPoint[0] = hitPoint[1] = hitPoint[2] = false; +} + +Arc::Arc(Vector ctr, double r, Point p1, Point p2, float th/*= 1.0*/, uint32_t c/*= 0*/, int l/*= LSSolid*/): type(OTArc), id(Global::objectID++), layer(0), color(c), thickness(th), style(l), selected(false), hovered(false), hitObject(false) +{ + p[0] = ctr; + radius[0] = r; + angle[0] = Vector::Angle(ctr, p1); +/* +s = 10, e = 20, span = 10 (why not -350?) +s = 20, e = 10, span = -10 (why not 350?) +s = 10, e = 350, span = 340 (why not -20?) +s = 350, e = 10, span = -340 (why not 20?) + +below is still not right, we need one more point to disambiguate this... +*/ + angle[1] = Vector::Angle(ctr, p2) - angle[0]; + hitPoint[0] = hitPoint[1] = hitPoint[2] = false; } Rect Arc::Bounds(void)