DsPoint is a class that represents the X and Y 2D coordinates of a point as integer numbers.
More...
#include <ds_geometry.h>
|
int32_t | x |
| X component.
|
|
int32_t | y |
| Y component.
|
|
DsPoint is a class that represents the X and Y 2D coordinates of a point as integer numbers.
◆ DsPoint()
DsPoint::DsPoint |
( |
int32_t |
x, |
|
|
int32_t |
y |
|
) |
| |
|
inline |
Creates a DsPoint object initialized to (x, y).
- Parameters
-
x | X coordinate |
y | Y coordinate |
◆ distance()
float DsPoint::distance |
( |
const DsPoint & |
p | ) |
const |
|
inline |
Calculates the Euclidian distance between the current DsPoint object and a second DsPoint object.
- Parameters
-
- Returns
- Euclidian distance
◆ distanceX()
float DsPoint::distanceX |
( |
const DsPoint & |
p | ) |
const |
|
inline |
Calculates the X component of the Euclidian distance between the current DsPoint object and a second DsPoint object.
- Parameters
-
- Returns
- X component of the Euclidian distance
◆ distanceY()
float DsPoint::distanceY |
( |
const DsPoint & |
p | ) |
const |
|
inline |
Calculates the Y component of the Euclidian distance between the current DsPoint object and a second DsPoint object.
- Parameters
-
- Returns
- Y component of the Euclidian distance
◆ operator+=() [1/2]
Addition operator - adds a DsPoint object to the current DsPoint object.
- Parameters
-
- Returns
- Object reference
◆ operator+=() [2/2]
DsPoint & DsPoint::operator+= |
( |
int32_t |
rhs | ) |
|
|
inline |
Addition operator - adds a number to both the X and Y coordinates of the current DsPoint object.
- Parameters
-
rhs | Right hand side number |
- Returns
- Object reference
◆ operator-()
DsPoint DsPoint::operator- |
( |
| ) |
const |
|
inline |
Unary minus operator. Reverses the signs of both the X and Y coordinates of the current DsPoint object.
- Returns
- DsPoint object with both the X and Y components of the current object having the signs reversed
◆ operator-=() [1/2]
Subtraction operator - subtract a DsPoint object from the current DsPoint object.
- Parameters
-
- Returns
- Object reference
◆ operator-=() [2/2]
DsPoint & DsPoint::operator-= |
( |
int32_t |
rhs | ) |
|
|
inline |
Subtraction operator - subtract a number from the current DsPoint object.
- Parameters
-
rhs | Right hand side number |
- Returns
- Object reference
◆ operator=()
Assignment operator from a DsFPoint object.
- Parameters
-
◆ operator==()
bool DsPoint::operator== |
( |
const DsPoint & |
rhs | ) |
|
|
inline |
Comparison operator.
- Parameters
-
rhs | Right hand side point of the comparison operator |
◆ saturate()
Saturates the current DsPoint object coordinates to the minimum and maximum specified.
- Parameters
-
min | Minimum value |
max | Maximum value |
- Returns
- Saturated DsPoint object
◆ saturateMax()
Saturates the current DsPoint object coordinates to the maximum specified.
- Parameters
-
- Returns
- Saturated DsPoint object
◆ saturateMin()
Saturates the current DsPoint object coordinates to the minimum specified.
- Parameters
-
- Returns
- Saturated DsPoint object
◆ distance
Calculates the Euclidian distance between two DsPoint objects.
- Parameters
-
- Returns
- Euclidian distance
◆ operator*
Multiplication operator - multiplies both X and Y coordinates of a DsPoint object with the same multiplier.
- Parameters
-
lhs | Left hand side DsPoint object |
multiplier | Right hand side multiplier |
- Returns
- lfs DsPoint object multiplied by the multiplier
◆ operator+ [1/2]
Addition operator - adds two DsPoint objects.
- Parameters
-
- Returns
- The sum of lhs and rhs DsPoint objects
◆ operator+ [2/2]
Addition operator - adds a number to both the X and Y coordinates of a DsPoint object.
- Parameters
-
lhs | Left hand side DsPoint object |
rhs | Right hand side number |
- Returns
- The sum of lhs object and the rhs number (x + rhs, y + rhs)
◆ operator- [1/2]
Subtraction operator - subtract two DsPoint objects.
- Parameters
-
- Returns
- The difference between lhs and rhs DsPoint objects
◆ operator- [2/2]
Subtraction operator - subtract a number from a DsPoint object.
- Parameters
-
lhs | Left hand side DsPoint object |
rhs | Right hand side number |
- Returns
- The difference between lhs object and the rhs number (x - rhs, y - rhs)
◆ operator/ [1/2]
Integer division operator - divides both X and Y coordinates of a DsPoint object by the same divisor.
- Parameters
-
lhs | Left hand side DsPoint object |
divisor | Right hand side divisor |
- Returns
- lfs DsPoint object divided by the divisor
◆ operator/ [2/2]
Integer division operator - divides both X and Y coordinates of a DsPoint object by the same divisor.
- Parameters
-
lhs | Left hand side DsPoint object |
divisor | Right hand side divisor |
- Returns
- lfs DsPoint object divided by the divisor
The documentation for this class was generated from the following file: