4 #include "atomicentity.h"
7 * Holds the data that defines a circle.
16 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);
35 friend std::ostream & operator<<(std::ostream & os, const CircleData & ad)
37 os << "(" << ad.center << "/" << ad.radius << ")";
47 * Class for a circle entity.
49 * @author Andrew Mustun
51 class Circle: public AtomicEntity
54 Circle(EntityContainer * parent, const CircleData & d);
57 virtual Entity * clone();
58 virtual RS2::EntityType rtti() const;
59 virtual bool isEdge() const;
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, 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, 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 Circle & a);
94 virtual void calculateBorders();