DGtal 1.4.0
Loading...
Searching...
No Matches
StraightLineFrom2Points.h
1
17#pragma once
18
34#if defined(StraightLineFrom2Points_RECURSES)
35#error Recursive header files inclusion detected in StraightLineFrom2Points.h
36#else // defined(StraightLineFrom2Points_RECURSES)
38#define StraightLineFrom2Points_RECURSES
39
40#if !defined StraightLineFrom2Points_h
42#define StraightLineFrom2Points_h
43
45// Inclusions
46#include <iostream>
47
48#include "DGtal/base/Common.h"
49#include "DGtal/kernel/PointVector.h"
50#include "DGtal/kernel/CInteger.h"
51#include "DGtal/io/Color.h"
53
54namespace DGtal
55{
56
57
59 // template class StraightLineFrom2Points
67 template <typename TPoint>
69 {
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
93 StraightLineFrom2Points(const Point& aFirstPoint, const Point& aSecondPoint);
94
100 void init(const Point& aFirstPoint, const Point& aSecondPoint);
101
107
114
115
120
121 // ----------------------- Interface --------------------------------------
122 public:
123
128 void selfDisplay ( std::ostream & out ) const;
129
134 bool isValid() const;
135
141 Distance signedDistance(const Point& aP) const;
142
146 const Point & p() const
147 {
148 return myP;
149 };
150
154 const Point & q() const
155 {
156 return myQ;
157 };
158
159 //------------------ display -------------------------------
164 //DrawableWithBoard2D* defaultStyle( std::string mode="" ) const;
165
169 std::string className() const;
170
171 // ------------------------- Protected Datas ------------------------------
172 private:
173 // ------------------------- Private Datas --------------------------------
174 private:
175 //the two points that uniquely define the straight line
184 // ------------------------- Hidden services ------------------------------
185 protected:
186
187
188 private:
189
190
191
192 // ------------------------- Internals ------------------------------------
193 private:
194
195
196
197
198 }; // end of class StraightLineFrom2Points
199
200
207 template <typename TPoint>
208 inline
209 std::ostream&
210 operator<< ( std::ostream & out,
211 const StraightLineFrom2Points<TPoint> & object )
212 {
213 object.selfDisplay( out );
214 return out;
215 }
216
217
218} // namespace DGtal
219
220
222// Includes inline functions.
223#include "DGtal/shapes/fromPoints/StraightLineFrom2Points.ih"
224
225// //
227
228#endif // !defined StraightLineFrom2Points_h
229
230#undef StraightLineFrom2Points_RECURSES
231#endif // else defined(StraightLineFrom2Points_RECURSES)
Aim: Represents a straight line uniquely defined by two 2D points and that is able to return for any ...
void init(const Point &aFirstPoint, const Point &aSecondPoint)
std::string className() const
StraightLineFrom2Points & operator=(const StraightLineFrom2Points &other)
Distance signedDistance(const Point &aP) const
StraightLineFrom2Points(const StraightLineFrom2Points &other)
void selfDisplay(std::ostream &out) const
StraightLineFrom2Points(const Point &aFirstPoint, const Point &aSecondPoint)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)