JeVoisBase  1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
Share this page:
Loading...
Searching...
No Matches
Point2D< T > Class Template Reference

This is a basic class to encode 2D integer coordinates. More...

#include <jevoisbase/Components/RoadFinder/Point2D.H>

Inheritance diagram for Point2D< T >:

Public Member Functions

 Point2D ()
 The default constructor initializes the coordinates to (0,0)
 
 Point2D (const T ii, const T jj)
 Initialize the Point2D from horizontal & vertical coordinates.
 
template<class U >
 Point2D (const Point2D< U > &a)
 Explicit conversion from type T to another type U.
 
Point2D< T > & operator+= (const Point2D< T > &p)
 += operator
 
Point2D< T > & operator-= (const Point2D< T > &p)
 -= operator
 
Point2D< T > & operator*= (const Point2D< T > &p)
 *= operator
 
Point2D< T > & operator/= (const Point2D< T > &p)
 /= operator
 
template<class U >
Point2D< typename promote_trait< T, U >::TP > operator+ (const Point2D< U > &p) const
 
template<class U >
Point2D< typename promote_trait< T, U >::TP > operator- (const Point2D< U > &p) const
 
template<class U >
Point2D< typename promote_trait< T, U >::TP > operator* (const Point2D< U > &p) const
 
template<class U >
Point2D< typename promote_trait< T, U >::TP > operator/ (const Point2D< U > &p) const
 / operator
 
Point2D< T > & operator+= (const T val)
 += operator
 
Point2D< T > & operator-= (const T val)
 -= operator
 
Point2D< T > & operator*= (const T val)
 *= operator
 
Point2D< T > & operator/= (const T val)
 /= operator
 
template<class U >
Point2D< typename promote_trait< T, U >::TP > operator+ (const U val) const
 
template<class U >
Point2D< typename promote_trait< T, U >::TP > operator- (const U val) const
 
template<class U >
Point2D< typename promote_trait< T, U >::TP > operator* (const U val) const
 
template<class U >
Point2D< typename promote_trait< T, U >::TP > operator/ (const U val) const
 / operator
 
bool isValid () const
 test whether i and j are both positive
 
promote_trait< T, float >::TP squdist (const Point2D< T > &p) const
 the square of the euclidean distance
 
promote_trait< T, float >::TP distance (const Point2D< T > &p) const
 the euclidean distance from p
 
promote_trait< T, float >::TP magnitude () const
 the Magnitude
 
promote_trait< T, float >::TP distanceToLine (const Point2D< T > &p, const Point2D< T > &q, const bool getsigned=false) const
 the euclidean distance from line pq
 
promote_trait< T, float >::TP distanceToSegment (const Point2D< T > &p, const Point2D< T > &q) const
 the euclidean distance from segment pq
 

Public Attributes

i
 2D coordinates
 
j
 

Detailed Description

template<class T>
class Point2D< T >

This is a basic class to encode 2D integer coordinates.

This is a completely public class whose goal is just to provide a shorthand notation for 2D integer coordinates.

Definition at line 66 of file Point2D.H.

Constructor & Destructor Documentation

◆ Point2D() [1/3]

template<class T >
Point2D< T >::Point2D ( )
inline

The default constructor initializes the coordinates to (0,0)

Definition at line 208 of file Point2D.H.

◆ Point2D() [2/3]

template<class T >
Point2D< T >::Point2D ( const T  ii,
const T  jj 
)
inline

Initialize the Point2D from horizontal & vertical coordinates.

Definition at line 213 of file Point2D.H.

◆ Point2D() [3/3]

template<class T >
template<class U >
Point2D< T >::Point2D ( const Point2D< U > &  a)
inlineexplicit

Explicit conversion from type T to another type U.

Note that this simply uses clamped_convert, so it will clamp coordinates to the available range of T, and may round down.

Definition at line 219 of file Point2D.H.

Member Function Documentation

◆ distance()

template<class T >
promote_trait< T, float >::TP Point2D< T >::distance ( const Point2D< T > &  p) const
inline

◆ distanceToLine()

template<class T >
promote_trait< T, float >::TP Point2D< T >::distanceToLine ( const Point2D< T > &  p,
const Point2D< T > &  q,
const bool  getsigned = false 
) const
inline

the euclidean distance from line pq

Definition at line 369 of file Point2D.H.

References Point2D< T >::i, and Point2D< T >::j.

◆ distanceToSegment()

template<class T >
promote_trait< T, float >::TP Point2D< T >::distanceToSegment ( const Point2D< T > &  p,
const Point2D< T > &  q 
) const
inline

the euclidean distance from segment pq

Definition at line 382 of file Point2D.H.

References Point2D< T >::i, and Point2D< T >::j.

◆ isValid()

template<class T >
bool Point2D< T >::isValid ( ) const
inline

test whether i and j are both positive

Definition at line 341 of file Point2D.H.

Referenced by RoadFinder::process().

◆ magnitude()

template<class T >
promote_trait< T, float >::TP Point2D< T >::magnitude ( ) const
inline

the Magnitude

Definition at line 363 of file Point2D.H.

◆ operator*() [1/2]

template<class T >
template<class U >
Point2D< typename promote_trait< T, U >::TP > Point2D< T >::operator* ( const Point2D< U > &  p) const
inline
  • operator

Definition at line 261 of file Point2D.H.

References Point2D< T >::i, and Point2D< T >::j.

◆ operator*() [2/2]

template<class T >
template<class U >
Point2D< typename promote_trait< T, U >::TP > Point2D< T >::operator* ( const U  val) const
inline
  • operator

Definition at line 309 of file Point2D.H.

◆ operator*=() [1/2]

template<class T >
Point2D< T > & Point2D< T >::operator*= ( const Point2D< T > &  p)
inline

*= operator

Definition at line 235 of file Point2D.H.

References Point2D< T >::i, and Point2D< T >::j.

◆ operator*=() [2/2]

template<class T >
Point2D< T > & Point2D< T >::operator*= ( const T  val)
inline

*= operator

Definition at line 283 of file Point2D.H.

◆ operator+() [1/2]

template<class T >
template<class U >
Point2D< typename promote_trait< T, U >::TP > Point2D< T >::operator+ ( const Point2D< U > &  p) const
inline
  • operator

Definition at line 247 of file Point2D.H.

References Point2D< T >::i, and Point2D< T >::j.

◆ operator+() [2/2]

template<class T >
template<class U >
Point2D< typename promote_trait< T, U >::TP > Point2D< T >::operator+ ( const U  val) const
inline
  • operator

Definition at line 295 of file Point2D.H.

◆ operator+=() [1/2]

template<class T >
Point2D< T > & Point2D< T >::operator+= ( const Point2D< T > &  p)
inline

+= operator

Definition at line 225 of file Point2D.H.

References Point2D< T >::i, and Point2D< T >::j.

◆ operator+=() [2/2]

template<class T >
Point2D< T > & Point2D< T >::operator+= ( const T  val)
inline

+= operator

Definition at line 273 of file Point2D.H.

◆ operator-() [1/2]

template<class T >
template<class U >
Point2D< typename promote_trait< T, U >::TP > Point2D< T >::operator- ( const Point2D< U > &  p) const
inline
  • operator

Definition at line 254 of file Point2D.H.

References Point2D< T >::i, and Point2D< T >::j.

◆ operator-() [2/2]

template<class T >
template<class U >
Point2D< typename promote_trait< T, U >::TP > Point2D< T >::operator- ( const U  val) const
inline
  • operator

Definition at line 302 of file Point2D.H.

◆ operator-=() [1/2]

template<class T >
Point2D< T > & Point2D< T >::operator-= ( const Point2D< T > &  p)
inline

-= operator

Definition at line 230 of file Point2D.H.

References Point2D< T >::i, and Point2D< T >::j.

◆ operator-=() [2/2]

template<class T >
Point2D< T > & Point2D< T >::operator-= ( const T  val)
inline

-= operator

Definition at line 278 of file Point2D.H.

◆ operator/() [1/2]

template<class T >
template<class U >
Point2D< typename promote_trait< T, U >::TP > Point2D< T >::operator/ ( const Point2D< U > &  p) const
inline

/ operator

Definition at line 268 of file Point2D.H.

References Point2D< T >::i, and Point2D< T >::j.

◆ operator/() [2/2]

template<class T >
template<class U >
Point2D< typename promote_trait< T, U >::TP > Point2D< T >::operator/ ( const U  val) const
inline

/ operator

Definition at line 316 of file Point2D.H.

◆ operator/=() [1/2]

template<class T >
Point2D< T > & Point2D< T >::operator/= ( const Point2D< T > &  p)
inline

/= operator

Definition at line 240 of file Point2D.H.

References Point2D< T >::i, and Point2D< T >::j.

◆ operator/=() [2/2]

template<class T >
Point2D< T > & Point2D< T >::operator/= ( const T  val)
inline

/= operator

Definition at line 288 of file Point2D.H.

◆ squdist()

template<class T >
promote_trait< T, float >::TP Point2D< T >::squdist ( const Point2D< T > &  p) const
inline

the square of the euclidean distance

Definition at line 347 of file Point2D.H.

References Point2D< T >::i, and Point2D< T >::j.

Member Data Documentation

◆ i

◆ j


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