#include "mathconstants.h"
const char objName[OTCount][16] = {
- "None", "Line", "Circle", "Ellipse", "Arc", "Polygon", "Dimension",
+ "None", "Line", "Circle", "Ellipse", "Arc", "Dimension",
"Spline", "Text", "Container"
};
const char dimName[DTCount][32] = {
{
}
-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)