4 #include "rs_atomicentity.h"
7 * Holds the data that defines an ellipse.
12 RS_EllipseData(const Vector & center, const Vector & majorP, double ratio, double angle1, double angle2, bool reversed)
14 this->center = center;
15 this->majorP = majorP;
17 this->angle1 = angle1;
18 this->angle2 = angle2;
19 this->reversed = reversed;
22 friend class RS_Ellipse;
24 friend std::ostream & operator<<(std::ostream & os, const RS_EllipseData & ed)
26 os << "(" << ed.center
38 //! Endpoint of major axis relative to center.
40 //! Ratio of minor axis to major axis.
46 //! Reversed (cw) flag
51 * Class for an ellipse entity. All angles are in Rad.
53 * @author Andrew Mustun
55 class RS_Ellipse: public RS_AtomicEntity
58 RS_Ellipse(RS_EntityContainer * parent, const RS_EllipseData & d);
59 virtual ~RS_Ellipse();
61 virtual RS_Entity * clone();
62 virtual RS2::EntityType rtti() const;
63 virtual Vector getStartpoint() const;
64 virtual Vector getEndpoint() const;
65 virtual void moveStartpoint(const Vector & pos);
66 virtual void moveEndpoint(const Vector & pos);
67 virtual RS2::Ending getTrimPoint(const Vector & coord, const Vector & trimPoint);
68 double getEllipseAngle(const Vector & pos);
69 RS_EllipseData getData();
70 virtual VectorSolutions getRefPoints();
71 bool isReversed() const;
72 void setReversed(bool r);
73 double getAngle() const;
75 void setAngle1(double a1);
77 void setAngle2(double a2);
79 void setCenter(const Vector & c);
81 void setMajorP(const Vector & p);
83 void setRatio(double r);
84 virtual double getAngleLength() const;
85 double getMajorRadius() const;
86 double getMinorRadius() const;
88 virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
89 virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true, double * dist = NULL, RS_Entity ** entity = NULL);
90 virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
91 virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
92 virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
93 virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
94 virtual bool isPointOnEntity(const Vector & coord, double tolerance = RS_TOLERANCE);
96 virtual void move(Vector offset);
97 virtual void rotate(Vector center, double angle);
98 virtual void scale(Vector center, Vector factor);
99 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
100 virtual void moveRef(const Vector & ref, const Vector & offset);
102 virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
104 friend std::ostream & operator<<(std::ostream & os, const RS_Ellipse & a);
106 //virtual void calculateEndpoints();
107 virtual void calculateBorders();