DGtal 1.3.0
Loading...
Searching...
No Matches
CircleFrom2Points.ih
1/**
2 * This program is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU Lesser General Public License as
4 * published by the Free Software Foundation, either version 3 of the
5 * License, or (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *
15 **/
16
17/**
18 * @file CircleFrom2Points.ih
19 * @author Tristan Roussillon (\c tristan.roussillon@liris.cnrs.fr )
20 * Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
21 *
22 * @date 2011/09/22
23 *
24 * @brief Implementation of inline methods defined in CircleFrom2Points.h
25 *
26 * This file is part of the DGtal library.
27 */
28
29
30//////////////////////////////////////////////////////////////////////////////
31#include <cstdlib>
32//////////////////////////////////////////////////////////////////////////////
33
34///////////////////////////////////////////////////////////////////////////////
35// IMPLEMENTATION of inline methods.
36///////////////////////////////////////////////////////////////////////////////
37
38///////////////////////////////////////////////////////////////////////////////
39// ----------------------- Standard services ------------------------------
40
41template <typename TPoint>
42inline
43DGtal::CircleFrom2Points<TPoint>::~CircleFrom2Points()
44{
45}
46
47template <typename TPoint>
48inline
49DGtal::CircleFrom2Points<TPoint>::CircleFrom2Points(const Point& aPole): myPole(aPole)
50{
51}
52
53template <typename TPoint>
54inline
55void
56DGtal::CircleFrom2Points<TPoint>::init(
57 const Point& aFirstPoint,
58 const Point& aSecondPoint)
59{
60 myP = aFirstPoint;
61 myQ = aSecondPoint;
62}
63
64
65template <typename TPoint>
66inline
67DGtal::CircleFrom2Points<TPoint>::CircleFrom2Points(
68 const Point& aPole,
69 const Point& aFirstPoint,
70 const Point& aSecondPoint):
71 myPole(aPole),
72 myP(aFirstPoint),
73 myQ(aSecondPoint)
74{
75}
76
77
78template <typename TPoint>
79inline
80DGtal::CircleFrom2Points<TPoint>::CircleFrom2Points(
81 const CircleFrom2Points & other):
82 myPole(other.myPole),
83 myP(other.myP),
84 myQ(other.myQ)
85{
86}
87
88
89template <typename TPoint>
90inline
91DGtal::CircleFrom2Points<TPoint>&
92DGtal::CircleFrom2Points<TPoint>::operator=(
93 const CircleFrom2Points & other)
94{
95 myP = other.myP;
96 myQ = other.myQ;
97 myPole = other.myPole;
98 return *this;
99}
100
101
102
103template <typename TPoint>
104inline
105typename DGtal::CircleFrom2Points<TPoint>::Distance
106DGtal::CircleFrom2Points<TPoint>::signedDistance(const Point& aP) const
107{
108 CircleFrom3Points<Point> c(myPole,myP,myQ);
109 return c.signedDistance(aP);
110}
111
112template <typename TPoint>
113inline
114void
115DGtal::CircleFrom2Points<TPoint>::getParameters(double& cx, double& cy, double& r) const
116{
117 CircleFrom3Points<Point> c(myPole,myP,myQ);
118 c.getParameters(cx,cy,r);
119}
120
121///////////////////////////////////////////////////////////////////////////////
122// Interface - public :
123
124template <typename TPoint>
125inline
126std::string
127DGtal::CircleFrom2Points<TPoint>::className() const
128{
129 return "CircleFrom2Points";
130}
131
132template <typename TPoint>
133inline
134void
135DGtal::CircleFrom2Points<TPoint>::selfDisplay ( std::ostream & out ) const
136{
137 out << "[CircleFrom2Points] passing through:\n";
138 out << "pole " << myPole << " and " << myP << myQ;
139}
140
141template <typename TPoint>
142inline
143bool
144DGtal::CircleFrom2Points<TPoint>::isValid() const
145{
146 return true;
147}
148
149