4 #include "rs_atomicentity.h"
7 * Holds the data that defines a circle.
16 RS_CircleData(const Vector & center, double radius)
18 this->center = center;
19 this->radius = radius;
24 center = Vector(false);
30 return (center.valid && radius > RS_TOLERANCE);
33 friend class RS_Circle;
35 friend std::ostream & operator<<(std::ostream & os, const RS_CircleData & ad)
37 os << "(" << ad.center << "/" << ad.radius << ")";
47 * Class for a circle entity.
49 * @author Andrew Mustun
51 class RS_Circle: public RS_AtomicEntity
54 RS_Circle (RS_EntityContainer * parent, const RS_CircleData & d);
57 virtual RS_Entity * clone();
58 virtual RS2::EntityType rtti() const;
59 virtual bool isEdge() const;
60 RS_CircleData getData();
61 virtual VectorSolutions getRefPoints();
62 virtual Vector getStartpoint() const;
63 virtual Vector getEndpoint() const;
64 double getDirection1() const;
65 double getDirection2() const;
67 void setCenter(const Vector & c);
69 void setRadius(double r);
70 double getAngleLength() const;
71 virtual double getLength();
73 bool createFromCR(const Vector & c, double r);
74 bool createFrom2P(const Vector & p1, const Vector & p2);
75 bool createFrom3P(const Vector & p1, const Vector & p2, const Vector & p3);
76 virtual Vector getNearestEndpoint(const Vector & coord, double * dist = NULL);
77 virtual Vector getNearestPointOnEntity(const Vector & coord, bool onEntity = true,
78 double * dist = NULL, RS_Entity ** entity = NULL);
79 virtual Vector getNearestCenter(const Vector & coord, double * dist = NULL);
80 virtual Vector getNearestMiddle(const Vector & coord, double * dist = NULL);
81 virtual Vector getNearestDist(double distance, const Vector & coord, double * dist = NULL);
82 virtual Vector getNearestDist(double distance, bool startp);
83 virtual double getDistanceToPoint(const Vector & coord, RS_Entity ** entity = NULL, RS2::ResolveLevel level = RS2::ResolveNone, double solidDist = RS_MAXDOUBLE);
85 virtual void move(Vector offset);
86 virtual void rotate(Vector center, double angle);
87 virtual void scale(Vector center, Vector factor);
88 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
89 virtual void moveRef(const Vector & ref, const Vector & offset);
90 virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
92 friend std::ostream & operator<<(std::ostream & os, const RS_Circle & a);
94 virtual void calculateBorders();