DGtal  1.5.beta
DGtal::StraightLineFrom2Points< TPoint > Class Template Reference

Aim: Represents a straight line uniquely defined by two 2D points and that is able to return for any given 2D point its signed distance to itself. More...

#include <DGtal/shapes/fromPoints/StraightLineFrom2Points.h>

Public Types

typedef TPoint::Coordinate Coordinate
 
typedef Coordinate Distance
 
typedef TPoint Point
 
typedef TPoint Vector
 

Public Member Functions

 StraightLineFrom2Points ()
 
 StraightLineFrom2Points (const Point &aFirstPoint, const Point &aSecondPoint)
 
void init (const Point &aFirstPoint, const Point &aSecondPoint)
 
 StraightLineFrom2Points (const StraightLineFrom2Points &other)
 
StraightLineFrom2Pointsoperator= (const StraightLineFrom2Points &other)
 
 ~StraightLineFrom2Points ()
 
void selfDisplay (std::ostream &out) const
 
bool isValid () const
 
Distance signedDistance (const Point &aP) const
 
const Pointp () const
 
const Pointq () const
 
std::string className () const
 

Private Attributes

Point myP
 
Point myQ
 

Detailed Description

template<typename TPoint>
class DGtal::StraightLineFrom2Points< TPoint >

Aim: Represents a straight line uniquely defined by two 2D points and that is able to return for any given 2D point its signed distance to itself.

Template Parameters
TPointa type of points.

Definition at line 68 of file StraightLineFrom2Points.h.

Member Typedef Documentation

◆ Coordinate

template<typename TPoint >
typedef TPoint::Coordinate DGtal::StraightLineFrom2Points< TPoint >::Coordinate

Definition at line 74 of file StraightLineFrom2Points.h.

◆ Distance

template<typename TPoint >
typedef Coordinate DGtal::StraightLineFrom2Points< TPoint >::Distance

Definition at line 75 of file StraightLineFrom2Points.h.

◆ Point

template<typename TPoint >
typedef TPoint DGtal::StraightLineFrom2Points< TPoint >::Point

Definition at line 76 of file StraightLineFrom2Points.h.

◆ Vector

template<typename TPoint >
typedef TPoint DGtal::StraightLineFrom2Points< TPoint >::Vector

Definition at line 77 of file StraightLineFrom2Points.h.

Constructor & Destructor Documentation

◆ StraightLineFrom2Points() [1/3]

template<typename TPoint >
DGtal::StraightLineFrom2Points< TPoint >::StraightLineFrom2Points ( )

Default constructor.

◆ StraightLineFrom2Points() [2/3]

template<typename TPoint >
DGtal::StraightLineFrom2Points< TPoint >::StraightLineFrom2Points ( const Point aFirstPoint,
const Point aSecondPoint 
)

Constructor.

Parameters
aFirstPointa point
aSecondPointanother point

◆ StraightLineFrom2Points() [3/3]

template<typename TPoint >
DGtal::StraightLineFrom2Points< TPoint >::StraightLineFrom2Points ( const StraightLineFrom2Points< TPoint > &  other)

Copy constructor.

Parameters
otherthe object to clone.

◆ ~StraightLineFrom2Points()

template<typename TPoint >
DGtal::StraightLineFrom2Points< TPoint >::~StraightLineFrom2Points ( )

Destructor. Does nothing

Member Function Documentation

◆ className()

template<typename TPoint >
std::string DGtal::StraightLineFrom2Points< TPoint >::className ( ) const

Default drawing style object.

Returns
the dyn. alloc. default style for this object.
the style name used for drawing this object.

◆ init()

template<typename TPoint >
void DGtal::StraightLineFrom2Points< TPoint >::init ( const Point aFirstPoint,
const Point aSecondPoint 
)

Init.

Parameters
aFirstPointa point
aSecondPointanother point

◆ isValid()

template<typename TPoint >
bool DGtal::StraightLineFrom2Points< TPoint >::isValid ( ) const

Checks the validity/consistency of the object.

Returns
'true' if the object is valid, 'false' otherwise.

◆ operator=()

template<typename TPoint >
StraightLineFrom2Points& DGtal::StraightLineFrom2Points< TPoint >::operator= ( const StraightLineFrom2Points< TPoint > &  other)

Assignment.

Parameters
otherthe object to copy.
Returns
a reference on 'this'.

◆ p()

template<typename TPoint >
const Point& DGtal::StraightLineFrom2Points< TPoint >::p ( ) const
inline
Returns
the first point through which the straight line passes.

Definition at line 146 of file StraightLineFrom2Points.h.

147  {
148  return myP;
149  };

References DGtal::StraightLineFrom2Points< TPoint >::myP.

◆ q()

template<typename TPoint >
const Point& DGtal::StraightLineFrom2Points< TPoint >::q ( ) const
inline
Returns
the second point through which the straight line passes.

Definition at line 154 of file StraightLineFrom2Points.h.

155  {
156  return myQ;
157  };

References DGtal::StraightLineFrom2Points< TPoint >::myQ.

◆ selfDisplay()

template<typename TPoint >
void DGtal::StraightLineFrom2Points< TPoint >::selfDisplay ( std::ostream &  out) const

Writes/Displays the object on an output stream.

Parameters
outthe output stream where the object is written.

◆ signedDistance()

template<typename TPoint >
Distance DGtal::StraightLineFrom2Points< TPoint >::signedDistance ( const Point aP) const

Computes the signed distance of aP to the straight line

Parameters
aPthe point to be tested.
Returns
the signed distance.

Field Documentation

◆ myP

template<typename TPoint >
Point DGtal::StraightLineFrom2Points< TPoint >::myP
private

First point through which the straight line passes

Definition at line 179 of file StraightLineFrom2Points.h.

Referenced by DGtal::StraightLineFrom2Points< TPoint >::p().

◆ myQ

template<typename TPoint >
Point DGtal::StraightLineFrom2Points< TPoint >::myQ
private

Second point through which the straight line passes

Definition at line 183 of file StraightLineFrom2Points.h.

Referenced by DGtal::StraightLineFrom2Points< TPoint >::q().


The documentation for this class was generated from the following file: