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 double getAngleAt(double distance, RS::From from = RS::FromStart) const;
68 
69  virtual RVector getVectorTo(const RVector& point,
70  bool limited = true, double strictRange = RMAXDOUBLE) const;
71 
72  RVector getCenter() const;
73  void setCenter(const RVector& vector);
74  double getRadius() const;
75  void setRadius(double radius);
76 
77  double getDiameter() const;
78  void setDiameter(double d);
79  double getCircumference() const;
80  void setCircumference(double c);
81  double getArea() const;
82  void setArea(double a);
83 
84  bool contains(const RVector& p) const;
85  //bool touchesCircleInternally(const RCircle& other) const;
86 
87  virtual bool move(const RVector& offset);
88  virtual bool rotate(double rotation, const RVector& center = RDEFAULT_RVECTOR);
89  virtual bool scale(const RVector& scaleFactors, const RVector& center = RDEFAULT_RVECTOR);
90  virtual bool mirror(const RLine& axis);
91  virtual bool flipHorizontal();
92  virtual bool flipVertical();
93 
94  virtual QSharedPointer<RShape> getTransformed(const QTransform& transform) const;
95 
96 protected:
97  virtual void print(QDebug dbg) const;
98 
99 public:
109  double radius;
110 };
111 
115 Q_DECLARE_METATYPE(QSharedPointer<RCircle>)
116 Q_DECLARE_METATYPE(QSharedPointer<RCircle>*)
117 
118 #endif