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(double cx, double cy, const double radius);
43  RCircle(const RVector& center, const double radius);
44  virtual ~RCircle();
45 
46  virtual RCircle* clone() const {
47  return new RCircle(*this);
48  }
49 
50  static RCircle createFrom2Points(const RVector& p1, const RVector& p2);
51  static RCircle createFrom3Points(const RVector& p1, const RVector& p2, const RVector& p3);
52 
53  bool isValid() const {
54  return center.isValid();
55  }
56 
57  virtual void to2D();
58 
59  virtual RBox getBoundingBox() const;
60  virtual double getLength() const;
61 
62  virtual QList<RVector> getEndPoints() const;
63  virtual QList<RVector> getMiddlePoints() const;
64  virtual QList<RVector> getCenterPoints() const;
65  virtual QList<RVector> getPointsWithDistanceToEnd(
66  double distance, RS::From from = RS::FromAny) const;
67 
68  virtual double getAngleAt(double distance, RS::From from = RS::FromStart) const;
69 
70  virtual RVector getVectorTo(const RVector& point,
71  bool limited = true, double strictRange = RMAXDOUBLE) const;
72 
73  RVector getCenter() const;
74  void setCenter(const RVector& vector);
75  double getRadius() const;
76  void setRadius(double radius);
77 
78  double getDiameter() const;
79  void setDiameter(double d);
80  double getCircumference() const;
81  void setCircumference(double c);
82  double getArea() const;
83  void setArea(double a);
84 
85  bool contains(const RVector& p) const;
86  //bool touchesCircleInternally(const RCircle& other) const;
87 
88  virtual bool move(const RVector& offset);
89  virtual bool rotate(double rotation, const RVector& center = RDEFAULT_RVECTOR);
90  virtual bool scale(const RVector& scaleFactors, const RVector& center = RDEFAULT_RVECTOR);
91  virtual bool mirror(const RLine& axis);
92  virtual bool flipHorizontal();
93  virtual bool flipVertical();
94 
95  virtual QSharedPointer<RShape> getTransformed(const QTransform& transform) const;
96 
97 protected:
98  virtual void print(QDebug dbg) const;
99 
100 public:
110  double radius;
111 };
112 
116 Q_DECLARE_METATYPE(QSharedPointer<RCircle>)
117 Q_DECLARE_METATYPE(QSharedPointer<RCircle>*)
118 
119 #endif