Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
DsFPoint Class Reference

DsFPoint is a class that represents the X and Y 2D coordinates of a point as floating point numbers. More...

#include <ds_geometry.h>

Public Member Functions

 DsFPoint ()
 Creates a DsFPoint object initialized to (0, 0).
 
 DsFPoint (float x, float y)
 Creates a DsFPoint object initialized to (x, y).
 
 DsFPoint (const DsPoint &rhs)
 Assignment operator from a DsFPoint object.
 
DsFPointoperator= (const DsPoint &rhs)
 Assignment operator from a DsPoint object.
 
void swap (void)
 Swaps the X and Y coordinates of the current DsFPoint object.
 
bool operator== (const DsFPoint &rhs)
 Comparison operator.
 
DsFPoint operator- () const
 Unary minus operator. Reverses the signs of both the X and Y coordinates of the current DsFPoint object.
 
DsFPointoperator+= (const DsFPoint &rhs)
 Addition operator - adds a DsFPoint object to the current DsFPoint object.
 
DsFPointoperator+= (float rhs)
 Addition operator - adds a number to both the X and Y coordinates of the current DsFPoint object.
 
DsFPointoperator-= (const DsFPoint &rhs)
 Subtraction operator - subtracts a DsFPoint object from the current DsFPoint object.
 
DsFPointoperator-= (float rhs)
 Subtraction operator - subtracts a number from the current DsFPoint object.
 
DsFPoint saturateMin (const DsFPoint &min)
 Saturates the current DsFPoint object coordinates to the minimum specified.
 
DsFPoint saturateMax (const DsFPoint &max)
 Saturates the current DsFPoint object coordinates to the maximum specified.
 
DsFPoint saturate (const DsFPoint &min, const DsFPoint &max)
 Saturates the current DsFPoint object coordinates to the minimum and maximum specified.
 
float distance (const DsFPoint &p) const
 Calculates the Euclidian distance between the current DsFPoint object and a second DsFPoint object.
 
float distanceX (const DsFPoint &p) const
 Calculates the X component of the Euclidian distance between the current DsFPoint object and a second DsFPoint object.
 
float distanceY (const DsFPoint &p) const
 Calculates the Y component of the Euclidian distance between the current DsFPoint object and a second DsFPoint object.
 
 operator DsPoint () const
 Conversion operator to DsPoint.
 

Public Attributes

float x
 X component.
 
float y
 Y component.
 

Friends

DsFPoint operator+ (const DsFPoint &lhs, const DsFPoint &rhs)
 Addition operator - adds two DsFPoint objects.
 
DsFPoint operator+ (const DsFPoint &lhs, float rhs)
 Addition operator - adds a number to both the X and Y coordinates of a DsFPoint object.
 
DsFPoint operator- (const DsFPoint &lhs, const DsFPoint &rhs)
 Subtraction operator - subtracts two DsFPoint objects.
 
DsFPoint operator- (const DsFPoint &lhs, float rhs)
 Subtraction operator - subtracts a number from a DsFPoint object.
 
DsFPoint operator* (const DsFPoint &lhs, float multiplier)
 Multiplication operator - multiplies both X and Y coordinates of a DsFPoint object with the same multiplier.
 
DsFPoint operator/ (const DsFPoint &lhs, float divisor)
 Floating point division operator - divides both X and Y coordinates of a DsFPoint object by the same divisor.
 
float distance (const DsFPoint &p1, const DsFPoint &p2)
 Calculates the Euclidian distance between two DsFPoint objects.
 

Detailed Description

DsFPoint is a class that represents the X and Y 2D coordinates of a point as floating point numbers.

Constructor & Destructor Documentation

◆ DsFPoint() [1/2]

DsFPoint::DsFPoint ( float  x,
float  y 
)
inline

Creates a DsFPoint object initialized to (x, y).

Parameters
xX coordinate
yY coordinate

◆ DsFPoint() [2/2]

DsFPoint::DsFPoint ( const DsPoint rhs)
inline

Assignment operator from a DsFPoint object.

Parameters
rhsSource point

Member Function Documentation

◆ distance()

float DsFPoint::distance ( const DsFPoint p) const
inline

Calculates the Euclidian distance between the current DsFPoint object and a second DsFPoint object.

Parameters
pSecond DsFPoint object
Returns
Euclidian distance

◆ distanceX()

float DsFPoint::distanceX ( const DsFPoint p) const
inline

Calculates the X component of the Euclidian distance between the current DsFPoint object and a second DsFPoint object.

Parameters
pSecond DsFPoint object
Returns
X component of the Euclidian distance

◆ distanceY()

float DsFPoint::distanceY ( const DsFPoint p) const
inline

Calculates the Y component of the Euclidian distance between the current DsFPoint object and a second DsFPoint object.

Parameters
pSecond DsFPoint object
Returns
Y component of the Euclidian distance

◆ operator DsPoint()

DsFPoint::operator DsPoint ( ) const
inline

Conversion operator to DsPoint.

Returns
DsPoint object

◆ operator+=() [1/2]

DsFPoint & DsFPoint::operator+= ( const DsFPoint rhs)
inline

Addition operator - adds a DsFPoint object to the current DsFPoint object.

Parameters
rhsRight hand side DsFPoint object
Returns
Object reference

◆ operator+=() [2/2]

DsFPoint & DsFPoint::operator+= ( float  rhs)
inline

Addition operator - adds a number to both the X and Y coordinates of the current DsFPoint object.

Parameters
rhsRight hand side number
Returns
Object reference

◆ operator-()

DsFPoint DsFPoint::operator- ( ) const
inline

Unary minus operator. Reverses the signs of both the X and Y coordinates of the current DsFPoint object.

Returns
DsFPoint object with both the X and Y components of the current object having the signs reversed

◆ operator-=() [1/2]

DsFPoint & DsFPoint::operator-= ( const DsFPoint rhs)
inline

Subtraction operator - subtracts a DsFPoint object from the current DsFPoint object.

Parameters
rhsRight hand side DsFPoint object
Returns
Object reference

◆ operator-=() [2/2]

DsFPoint & DsFPoint::operator-= ( float  rhs)
inline

Subtraction operator - subtracts a number from the current DsFPoint object.

Parameters
rhsRight hand side number
Returns
Object reference

◆ operator=()

DsFPoint & DsFPoint::operator= ( const DsPoint rhs)
inline

Assignment operator from a DsPoint object.

Parameters
rhsSource point

◆ operator==()

bool DsFPoint::operator== ( const DsFPoint rhs)
inline

Comparison operator.

Parameters
rhsRight hand side DsFPoint object of the comparison operator

◆ saturate()

DsFPoint DsFPoint::saturate ( const DsFPoint min,
const DsFPoint max 
)
inline

Saturates the current DsFPoint object coordinates to the minimum and maximum specified.

Parameters
minMinimum value
maxMaximum value
Returns
Saturated DsFPoint object

◆ saturateMax()

DsFPoint DsFPoint::saturateMax ( const DsFPoint max)
inline

Saturates the current DsFPoint object coordinates to the maximum specified.

Parameters
minMaximum value
Returns
Saturated DsFPoint object

◆ saturateMin()

DsFPoint DsFPoint::saturateMin ( const DsFPoint min)
inline

Saturates the current DsFPoint object coordinates to the minimum specified.

Parameters
minMinimum value
Returns
Saturated DsFPoint object

Friends And Related Symbol Documentation

◆ distance

float distance ( const DsFPoint p1,
const DsFPoint p2 
)
friend

Calculates the Euclidian distance between two DsFPoint objects.

Parameters
p1First DsFPoint object
p2Second DsFPoint object
Returns
Euclidian distance

◆ operator*

DsFPoint operator* ( const DsFPoint lhs,
float  multiplier 
)
friend

Multiplication operator - multiplies both X and Y coordinates of a DsFPoint object with the same multiplier.

Parameters
lhsLeft hand side point
multiplierRight hand side multiplier
Returns
lfs DsFPoint object multiplied by the multiplier

◆ operator+ [1/2]

DsFPoint operator+ ( const DsFPoint lhs,
const DsFPoint rhs 
)
friend

Addition operator - adds two DsFPoint objects.

Parameters
lhsLeft hand side DsFPoint object
rhsRight hand side DsFPoint object
Returns
The sum of lhs and rhs DsFPoint objects

◆ operator+ [2/2]

DsFPoint operator+ ( const DsFPoint lhs,
float  rhs 
)
friend

Addition operator - adds a number to both the X and Y coordinates of a DsFPoint object.

Parameters
lhsLeft hand side DsFPoint object
rhsRight hand side number
Returns
The sum of lhs DsFPoint object and the rhs number (x + rhs, y + rhs)

◆ operator- [1/2]

DsFPoint operator- ( const DsFPoint lhs,
const DsFPoint rhs 
)
friend

Subtraction operator - subtracts two DsFPoint objects.

Parameters
lhsLeft hand side DsFPoint object
rhsRight hand side DsFPoint object
Returns
The difference between lhs and rhs DsFPoint objects

◆ operator- [2/2]

DsFPoint operator- ( const DsFPoint lhs,
float  rhs 
)
friend

Subtraction operator - subtracts a number from a DsFPoint object.

Parameters
lhsLeft hand side DsFPoint object
rhsRight hand side number
Returns
The difference between lhs DsFPoint object and the rhs number (x - rhs, y - rhs)

◆ operator/

DsFPoint operator/ ( const DsFPoint lhs,
float  divisor 
)
friend

Floating point division operator - divides both X and Y coordinates of a DsFPoint object by the same divisor.

Parameters
lhsLeft hand side DsFPoint object
divisorRight hand side divisor
Returns
lfs DsFPoint object divided by the divisor

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