DGtal 1.4.0
Loading...
Searching...
No Matches
CircleFrom3Points.h
1
17#pragma once
18
32#if defined(CircleFrom3Points_RECURSES)
33#error Recursive header files inclusion detected in CircleFrom3Points.h
34#else // defined(CircleFrom3Points_RECURSES)
36#define CircleFrom3Points_RECURSES
37
38#if !defined CircleFrom3Points_h
40#define CircleFrom3Points_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"
51
52namespace DGtal
53{
54
55
57 // template class CircleFrom3Points
65 template <typename TPoint>
67 {
68
69 BOOST_STATIC_ASSERT(( TPoint::dimension == 2 ));
70
71 // ----------------------- associated types ------------------------------
72 public:
73
74 typedef typename TPoint::Coordinate Coordinate;
75 typedef Coordinate Distance; //to promote
76 typedef TPoint Point;
77 typedef TPoint Vector;
78
79 // ----------------------- Standard services ------------------------------
80 public:
81
86
87
94 CircleFrom3Points(const Point& aFirstPoint, const Point& aSecondPoint, const Point& aThirdPoint);
95
102 void init(const Point& aFirstPoint, const Point& aSecondPoint, const Point& aThirdPoint);
103
109
116
117
122
123 // ----------------------- Interface --------------------------------------
124 public:
125
131 Distance signedDistance(const Point& aP) const;
132
133 //------------------ accessors -------------------------------
138 bool isValid() const;
139
147 void getParameters(double& cx, double& cy, double& rr) const;
148
152 double getCurvature() const;
153
157 const Point & p() const
158 {
159 return myP;
160 };
161
165 const Point & q() const
166 {
167 return myQ;
168 };
169
173 const Point & r() const
174 {
175 return myR;
176 };
177
178
179 //------------------ display -------------------------------
180
185 void selfDisplay ( std::ostream & out ) const;
186
190 std::string className() const;
191
192
193 // ------------------------- Protected Datas ------------------------------
194 private:
195 // ------------------------- Private Datas --------------------------------
196 private:
197 //the three points that uniquely define the circle
210 // ------------------------- Hidden services ------------------------------
211 protected:
212
213
214 private:
215
216
217
218 // ------------------------- Internals ------------------------------------
219 private:
220
221
222
223
224 }; // end of class CircleFrom3Points
225
226
233 template <typename TPoint>
234 inline
235 std::ostream&
236 operator<< ( std::ostream & out,
237 const CircleFrom3Points<TPoint> & object )
238 {
239 object.selfDisplay( out );
240 return out;
241 }
242
243
244} // namespace DGtal
245
246
248// Includes inline functions.
249#include "DGtal/shapes/fromPoints/CircleFrom3Points.ih"
250
251// //
253
254#endif // !defined CircleFrom3Points_h
255
256#undef CircleFrom3Points_RECURSES
257#endif // else defined(CircleFrom3Points_RECURSES)
Aim: Represents a circle uniquely defined by three 2D points and that is able to return for any given...
CircleFrom3Points(const CircleFrom3Points &other)
const Point & p() const
void getParameters(double &cx, double &cy, double &rr) const
TPoint::Coordinate Coordinate
Distance signedDistance(const Point &aP) const
void selfDisplay(std::ostream &out) const
CircleFrom3Points(const Point &aFirstPoint, const Point &aSecondPoint, const Point &aThirdPoint)
const Point & q() const
BOOST_STATIC_ASSERT((TPoint::dimension==2))
CircleFrom3Points & operator=(const CircleFrom3Points &other)
const Point & r() const
double getCurvature() const
std::string className() const
void init(const Point &aFirstPoint, const Point &aSecondPoint, const Point &aThirdPoint)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)