DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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)
35 
36 #define CircleFrom2Points_RECURSES
37 
38 #if !defined CircleFrom2Points_h
39 
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 
107  CircleFrom2Points ( const CircleFrom2Points & other );
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 
209  private:
210 
211 
212 
213  // ------------------------- Internals ------------------------------------
214  private:
215 
216 
217 
218 
219  }; // end of class CircleFrom2Points
220 
221 
228  template <typename TPoint>
229  inline
230  std::ostream&
231  operator<< ( std::ostream & out,
232  const CircleFrom2Points<TPoint> & object )
233  {
234  object.selfDisplay( out );
235  return out;
236  }
237 
238 
239 } // namespace DGtal
240 
241 
243 // Includes inline functions.
244 #include "DGtal/shapes/fromPoints/CircleFrom2Points.ih"
245 
246 // //
248 
249 #endif // !defined CircleFrom2Points_h
250 
251 #undef CircleFrom2Points_RECURSES
252 #endif // else defined(CircleFrom2Points_RECURSES)