DGtal  1.5.beta
CircleFrom2Points.h
1 
17 #pragma once
18 
32 #if defined(CircleFrom2Points_RECURSES)
33 #error Recursive header files inclusion detected in CircleFrom2Points.h
34 #else // defined(CircleFrom2Points_RECURSES)
36 #define CircleFrom2Points_RECURSES
37 
38 #if !defined CircleFrom2Points_h
40 #define CircleFrom2Points_h
41 
43 // Inclusions
44 #include <iostream>
45 
46 #include "DGtal/base/Common.h"
47 #include "DGtal/kernel/PointVector.h"
48 #include "DGtal/kernel/NumberTraits.h"
49 #include "DGtal/io/Color.h"
50 #include "DGtal/shapes/fromPoints/CircleFrom3Points.h"
52 
53 namespace DGtal
54 {
55 
56 
58  // template class CircleFrom2Points
66  template <typename TPoint>
68  {
69 
70  // ----------------------- associated types ------------------------------
71  public:
72 
73  typedef typename TPoint::Coordinate Coordinate;
74  typedef Coordinate Distance; //to promote
75  typedef TPoint Point;
76  typedef TPoint Vector;
77 
78  // ----------------------- Standard services ------------------------------
79  public:
80 
85  CircleFrom2Points(const Point& aPole);
86 
87 
94  CircleFrom2Points(const Point& aPole, const Point& aFirstPoint, const Point& aSecondPoint);
95 
101  void init(const Point& aFirstPoint, const Point& aSecondPoint);
102 
108 
115 
116 
121 
122  // ----------------------- Interface --------------------------------------
123  public:
124 
129  void selfDisplay ( std::ostream & out ) const;
130 
135  bool isValid() const;
136 
142  Distance signedDistance(const Point& aP) const;
143 
150  void getParameters(double& cx, double& cy, double& r) const;
151 
155  const Point & pole() const
156  {
157  return myPole;
158  };
159 
163  const Point & p() const
164  {
165  return myP;
166  };
167 
171  const Point & q() const
172  {
173  return myQ;
174  };
175 
176  //------------------ display -------------------------------
181  //DrawableWithBoard2D* defaultStyle( std::string mode="" ) const;
182 
186  std::string className() const;
187 
188  // ------------------------- Protected Datas ------------------------------
189  private:
190  // ------------------------- Private Datas --------------------------------
191  private:
192  //the three points that uniquely define the circle
205  // ------------------------- Hidden services ------------------------------
206  protected:
207 
208  // ------------------------- Internals ------------------------------------
209  private:
210 
211 
212 
213 
214  }; // end of class CircleFrom2Points
215 
216 
223  template <typename TPoint>
224  inline
225  std::ostream&
226  operator<< ( std::ostream & out,
227  const CircleFrom2Points<TPoint> & object )
228  {
229  object.selfDisplay( out );
230  return out;
231  }
232 
233 
234 } // namespace DGtal
235 
236 
238 // Includes inline functions.
239 #include "DGtal/shapes/fromPoints/CircleFrom2Points.ih"
240 
241 // //
243 
244 #endif // !defined CircleFrom2Points_h
245 
246 #undef CircleFrom2Points_RECURSES
247 #endif // else defined(CircleFrom2Points_RECURSES)
Aim: Represents a circle that passes through a given point and that is thus uniquely defined by two o...
const Point & q() const
void getParameters(double &cx, double &cy, double &r) const
const Point & p() const
CircleFrom2Points & operator=(const CircleFrom2Points &other)
std::string className() const
CircleFrom2Points(const CircleFrom2Points &other)
void init(const Point &aFirstPoint, const Point &aSecondPoint)
TPoint::Coordinate Coordinate
CircleFrom2Points(const Point &aPole, const Point &aFirstPoint, const Point &aSecondPoint)
CircleFrom2Points(const Point &aPole)
void selfDisplay(std::ostream &out) const
Distance signedDistance(const Point &aP) const
const Point & pole() const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ATu0v1< TKSpace, TLinearAlgebra > &object)