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.
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.
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/>.
18 * @file StraightLineFrom2Points.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
24 * Implementation of inline methods defined in StraightLineFrom2Points.h
26 * This file is part of the DGtal library.
30//////////////////////////////////////////////////////////////////////////////
32//////////////////////////////////////////////////////////////////////////////
34///////////////////////////////////////////////////////////////////////////////
35// IMPLEMENTATION of inline methods.
36///////////////////////////////////////////////////////////////////////////////
38///////////////////////////////////////////////////////////////////////////////
39// ----------------------- Standard services ------------------------------
41template <typename TPoint>
43DGtal::StraightLineFrom2Points<TPoint>::~StraightLineFrom2Points()
47template <typename TPoint>
49DGtal::StraightLineFrom2Points<TPoint>::StraightLineFrom2Points()
53template <typename TPoint>
56DGtal::StraightLineFrom2Points<TPoint>::init(
57 const Point& aFirstPoint,
58 const Point& aSecondPoint)
65template <typename TPoint>
67DGtal::StraightLineFrom2Points<TPoint>::StraightLineFrom2Points(
68 const Point& aFirstPoint,
69 const Point& aSecondPoint):
76template <typename TPoint>
78DGtal::StraightLineFrom2Points<TPoint>::StraightLineFrom2Points(
79 const StraightLineFrom2Points & other):
86template <typename TPoint>
88DGtal::StraightLineFrom2Points<TPoint>&
89DGtal::StraightLineFrom2Points<TPoint>::operator=(
90 const StraightLineFrom2Points & other)
99template <typename TPoint>
101typename DGtal::StraightLineFrom2Points<TPoint>::Distance
102DGtal::StraightLineFrom2Points<TPoint>::signedDistance(const Point& aP) const
104 Vector pq = myQ - myP;
105 Vector pr = aP - myP;
106 //computation of det(pq, pr)
107 //(= twice the parallelogram area)
108 return ((pq[0] * pr[1]) - (pq[1] * pr[0]));
112///////////////////////////////////////////////////////////////////////////////
113// Interface - public :
115template <typename TPoint>
118DGtal::StraightLineFrom2Points<TPoint>::className() const
120 return "StraightLineFrom2Points";
123template <typename TPoint>
126DGtal::StraightLineFrom2Points<TPoint>::selfDisplay ( std::ostream & out ) const
128 out << "[StraightLineFrom2Points] passing through:\n";
132template <typename TPoint>
135DGtal::StraightLineFrom2Points<TPoint>::isValid() const