Drag[en]gine Game Engine  1.21
decPoint Class Reference

2 Component Integer Point. More...

#include <decPoint.h>

Public Member Functions

Constructors and Destructors
 decPoint ()
 Create new point initialized to ( 0,0 ). More...
 
 decPoint (int nx, int ny)
 Create new point with the given values. More...
 
 decPoint (const decPoint &p)
 Create new point with the values of another point. More...
 
 decPoint (const decVector2 &v)
 Create new point from a vector. Fractional parts of all components are discarded. More...
 
Management
float Length () const
 Length of the point. More...
 
void SetZero ()
 Sets all components to 0. More...
 
void Set (int nx, int ny)
 Set components to the given values. More...
 
decPoint Absolute () const
 Retrieves absolute point. More...
 
void SetSmallest (const decPoint &p)
 Set each component to the smallest value of this point and another point. More...
 
decPoint Smallest (const decPoint &p) const
 Retrieve point with each component set to the smallest value of this point and another point. More...
 
void SetLargest (const decPoint &p)
 Set each component to the largest value of this point and another point. More...
 
decPoint Largest (const decPoint &p) const
 Retrieve point with each component set to the largest value of this point and another point. More...
 
void SetClamped (const decPoint &minValue, const decPoint &maxValue)
 Clamp each component to the provided range. More...
 
decPoint Clamped (const decPoint &minValue, const decPoint &maxValue) const
 Retrieves point with each component clamped to the provided range. More...
 
Operators
decPoint operator- () const
 Negation of this point. More...
 
decPointoperator= (const decPoint &p)
 Set components of this point to the values of another one. More...
 
decPointoperator+= (const decPoint &p)
 Adds the components of another point to this one. More...
 
decPointoperator-= (const decPoint &p)
 Subtracts the components of another point from this point. More...
 
decPointoperator*= (int k)
 Multiplies the components of this point with a value k. More...
 
decPointoperator/= (int k)
 Divides the components of this point by a value k. If the value k is 0 an exception is thrown. More...
 
decPoint operator+ (const decPoint &p) const
 Retrieves a new point with the sum of this point with another one. More...
 
decPoint operator- (const decPoint &p) const
 Retrieves a new point with the difference of this point to another one. More...
 
decPoint operator* (int k) const
 Retrieves a new point with this point scaled by k. More...
 
int operator* (const decPoint &p) const
 Calculates the dot product of this point with another one. More...
 
decPoint operator/ (int k) const
 Retrieves a new point with this point divided by k. If k is 0 an exception is thrown. More...
 
bool operator== (const decPoint &p) const
 Determines if this point is component wise equal to another point. More...
 
bool operator!= (const decPoint &p) const
 Determines if this point is component wise not equal to another point. More...
 
bool operator< (const decPoint &p) const
 Determines if all the components of this point are less then the components of another one. More...
 
bool operator> (const decPoint &p) const
 Determines if all the components of this point are greater then the components of another one. More...
 
bool operator<= (const decPoint &p) const
 Determines if all the components of this point are less then or equal to the components of another one. More...
 
bool operator>= (const decPoint &p) const
 Determines if all the components of this point are greater then or equal to the components of another one. More...
 

Public Attributes

int x
 X Component of point. More...
 
int y
 Y Component of point. More...
 

Detailed Description

2 Component Integer Point.

Constructor & Destructor Documentation

◆ decPoint() [1/4]

decPoint::decPoint ( )

Create new point initialized to ( 0,0 ).

◆ decPoint() [2/4]

decPoint::decPoint ( int  nx,
int  ny 
)

Create new point with the given values.

◆ decPoint() [3/4]

decPoint::decPoint ( const decPoint p)

Create new point with the values of another point.

◆ decPoint() [4/4]

decPoint::decPoint ( const decVector2 v)

Create new point from a vector. Fractional parts of all components are discarded.

Member Function Documentation

◆ Absolute()

decPoint decPoint::Absolute ( ) const

Retrieves absolute point.

◆ Clamped()

decPoint decPoint::Clamped ( const decPoint minValue,
const decPoint maxValue 
) const

Retrieves point with each component clamped to the provided range.

◆ Largest()

decPoint decPoint::Largest ( const decPoint p) const

Retrieve point with each component set to the largest value of this point and another point.

◆ Length()

float decPoint::Length ( ) const

Length of the point.

◆ operator!=()

bool decPoint::operator!= ( const decPoint p) const

Determines if this point is component wise not equal to another point.

◆ operator*() [1/2]

int decPoint::operator* ( const decPoint p) const

Calculates the dot product of this point with another one.

◆ operator*() [2/2]

decPoint decPoint::operator* ( int  k) const

Retrieves a new point with this point scaled by k.

◆ operator*=()

decPoint& decPoint::operator*= ( int  k)

Multiplies the components of this point with a value k.

◆ operator+()

decPoint decPoint::operator+ ( const decPoint p) const

Retrieves a new point with the sum of this point with another one.

◆ operator+=()

decPoint& decPoint::operator+= ( const decPoint p)

Adds the components of another point to this one.

◆ operator-() [1/2]

decPoint decPoint::operator- ( ) const

Negation of this point.

◆ operator-() [2/2]

decPoint decPoint::operator- ( const decPoint p) const

Retrieves a new point with the difference of this point to another one.

◆ operator-=()

decPoint& decPoint::operator-= ( const decPoint p)

Subtracts the components of another point from this point.

◆ operator/()

decPoint decPoint::operator/ ( int  k) const

Retrieves a new point with this point divided by k. If k is 0 an exception is thrown.

◆ operator/=()

decPoint& decPoint::operator/= ( int  k)

Divides the components of this point by a value k. If the value k is 0 an exception is thrown.

◆ operator<()

bool decPoint::operator< ( const decPoint p) const

Determines if all the components of this point are less then the components of another one.

◆ operator<=()

bool decPoint::operator<= ( const decPoint p) const

Determines if all the components of this point are less then or equal to the components of another one.

◆ operator=()

decPoint& decPoint::operator= ( const decPoint p)

Set components of this point to the values of another one.

◆ operator==()

bool decPoint::operator== ( const decPoint p) const

Determines if this point is component wise equal to another point.

◆ operator>()

bool decPoint::operator> ( const decPoint p) const

Determines if all the components of this point are greater then the components of another one.

◆ operator>=()

bool decPoint::operator>= ( const decPoint p) const

Determines if all the components of this point are greater then or equal to the components of another one.

◆ Set()

void decPoint::Set ( int  nx,
int  ny 
)

Set components to the given values.

◆ SetClamped()

void decPoint::SetClamped ( const decPoint minValue,
const decPoint maxValue 
)

Clamp each component to the provided range.

◆ SetLargest()

void decPoint::SetLargest ( const decPoint p)

Set each component to the largest value of this point and another point.

◆ SetSmallest()

void decPoint::SetSmallest ( const decPoint p)

Set each component to the smallest value of this point and another point.

◆ SetZero()

void decPoint::SetZero ( )

Sets all components to 0.

◆ Smallest()

decPoint decPoint::Smallest ( const decPoint p) const

Retrieve point with each component set to the smallest value of this point and another point.

Member Data Documentation

◆ x

int decPoint::x

X Component of point.

Referenced by decBoundary::MapPoint().

◆ y

int decPoint::y

Y Component of point.

Referenced by decBoundary::MapPoint().


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