QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RCircle.h
Go to the documentation of this file.
1 
20 #ifndef RCIRCLE_H
21 #define RCIRCLE_H
22 
23 #include "../core_global.h"
24 
25 #include "RShape.h"
26 #include "RVector.h"
27 
28 class RBox;
29 
40 public:
41  RCircle();
42  RCircle(const RVector& center, const double radius);
43  virtual ~RCircle();
44 
45  virtual RCircle* clone() const {
46  return new RCircle(*this);
47  }
48 
49  static RCircle createFrom2Points(const RVector& p1, const RVector& p2);
50  static RCircle createFrom3Points(const RVector& p1, const RVector& p2, const RVector& p3);
51 
52  bool isValid() const {
53  return center.isValid();
54  }
55 
56  virtual void to2D();
57 
58  virtual RBox getBoundingBox() const;
59  virtual double getLength() const;
60 
61  virtual QList<RVector> getEndPoints() const;
62  virtual QList<RVector> getMiddlePoints() const;
63  virtual QList<RVector> getCenterPoints() const;
64  virtual QList<RVector> getPointsWithDistanceToEnd(
65  double distance, RS::From from = RS::FromAny) const;
66 
67  virtual RVector getVectorTo(const RVector& point,
68  bool limited = true, double strictRange = RMAXDOUBLE) const;
69 
70  RVector getCenter() const;
71  void setCenter(const RVector& vector);
72  double getRadius() const;
73  void setRadius(double radius);
74 
75  double getDiameter() const;
76  void setDiameter(double d);
77  double getCircumference() const;
78  void setCircumference(double c);
79  double getArea() const;
80  void setArea(double a);
81 
82  bool contains(const RVector& p) const;
83  //bool touchesCircleInternally(const RCircle& other) const;
84 
85  virtual bool move(const RVector& offset);
86  virtual bool rotate(double rotation, const RVector& center = RDEFAULT_RVECTOR);
87  virtual bool scale(const RVector& scaleFactors, const RVector& center = RDEFAULT_RVECTOR);
88  virtual bool mirror(const RLine& axis);
89  virtual bool flipHorizontal();
90  virtual bool flipVertical();
91 
92  virtual QSharedPointer<RShape> getTransformed(const QTransform& transform) const;
93 
94 protected:
95  virtual void print(QDebug dbg) const;
96 
97 public:
107  double radius;
108 };
109 
113 Q_DECLARE_METATYPE(QSharedPointer<RCircle>)
114 Q_DECLARE_METATYPE(QSharedPointer<RCircle>*)
115 
116 #endif