PPoint2Df Class Reference

Detailed Description

The PPoint2Df class represents a 2D-point with float coordinates; PPoint2Df instances are immutable (thread-safe).

Definition at line 28 of file PPoint2Df.h.

#include <PPoint2Df.h>

Constructor & Destructor Documentation

◆ PPoint2Df() [1/4]

PPoint2Df::PPoint2Df ( float  xx = 0.0f,
float  yy = 0.0f 
)
explicit

Constructs a 2D-point from its coordinates (x, y), (0,0) by default.

◆ PPoint2Df() [2/4]

PPoint2Df::PPoint2Df ( double  xx,
double  yy 
)
explicit

Constructs a 2D-point from its coordinates (x, y), (0,0) by default.

◆ PPoint2Df() [3/4]

PPoint2Df::PPoint2Df ( papillon::int32  xx,
papillon::int32  yy 
)
explicit

Constructs a 2D-point from its coordinates (x, y), (0,0) by default.

◆ PPoint2Df() [4/4]

PPoint2Df::PPoint2Df ( const PPoint2Df other)

Constructs a shared copy of other.

◆ ~PPoint2Df()

virtual PPoint2Df::~PPoint2Df ( )
virtual

Destroys this object.

Member Function Documentation

◆ Bad()

static const PPoint2Df& PPoint2Df::Bad ( )
inlinestatic

Returns the constant holding the bad instance of a PPoint2Df.

Definition at line 34 of file PPoint2Df.h.

◆ EuclideanDistance()

float PPoint2Df::EuclideanDistance ( const PPoint2Df other) const

Computes the Euclidean distance between this and other point.

◆ GetX()

float PPoint2Df::GetX ( ) const

Returns the first coordinate of this 2D-point (column).

◆ GetY()

float PPoint2Df::GetY ( ) const

Returns the second coordinate of this 2D-point (row).

◆ IsBad()

bool PPoint2Df::IsBad ( ) const

Returns true if this 2D-point is NOT valid (at least one NaN coordinate), false otherwise.

◆ IsValid()

bool PPoint2Df::IsValid ( ) const

Returns true if this 2D-point is valid (no NaN coordinates), false otherwise.

◆ Middle()

static PPoint2Df PPoint2Df::Middle ( const PPoint2Df A,
const PPoint2Df B 
)
static

Returns the middle of the segment [AB].

◆ operator!=()

bool PPoint2Df::operator!= ( const PPoint2Df other) const

Returns true if this 2D-point is different of other, false otherwise.

WARNING: if A = Bad() and B = Bad(), then A != B (A == B will return false, because of NaN).

◆ operator*()

PPoint2Df PPoint2Df::operator* ( float  scaleBy) const

Returns a point corresponding to this point where both coordinates have been scaled by the given factor.

◆ operator+()

PPoint2Df PPoint2Df::operator+ ( const PPoint2Df v) const

Returns a point corresponding to this point translated by the specified vector v.

◆ operator-() [1/2]

PPoint2Df PPoint2Df::operator- ( const PPoint2Df v) const

Returns a point corresponding to this point translated by the specified vector -v.

◆ operator-() [2/2]

PPoint2Df PPoint2Df::operator- ( ) const

Returns a point with unary minus operator applied to coordinates.

◆ operator=()

PPoint2Df& PPoint2Df::operator= ( const PPoint2Df other)

Performs a shared copy of other to this object.

◆ operator==()

bool PPoint2Df::operator== ( const PPoint2Df other) const

Returns true if this 2D-point is the same than other, false otherwise.

WARNING: if A = Bad() and B = Bad(), then A != B (A == B will return false, because of NaN).

◆ Scaled()

PPoint2Df PPoint2Df::Scaled ( float  scaleBy) const

Returns a point corresponding to this point where both coordinates have been scaled by the given factor.

This can be useful if you have feature points in an image and then scale the image by a factor.

◆ ToPPoint2Di()

PPoint2Di PPoint2Df::ToPPoint2Di ( ) const

Returns a PPoint2Di from this point.

◆ Translated() [1/2]

PPoint2Df PPoint2Df::Translated ( float  vx,
float  vy 
) const

Returns a point corresponding to this point translated by the specified vector (vx, vy).

◆ Translated() [2/2]

PPoint2Df PPoint2Df::Translated ( const PPoint2Df v) const

Returns a point corresponding to this point translated by the specified vector (vx, vy).

◆ Zero()

static const PPoint2Df& PPoint2Df::Zero ( )
inlinestatic

Returns the constant holding the point (0,0).

Definition at line 39 of file PPoint2Df.h.