Colobot
Public Member Functions | Public Attributes | Friends | List of all members
Math::IntPoint Struct Reference

2D Point with integer coords More...

#include <intpoint.h>

Public Member Functions

 IntPoint (int aX=0, int aY=0)
 
bool operator== (const IntPoint &p) const
 
bool operator!= (const IntPoint &p) const
 
float Length () const
 
void LoadZero ()
 Sets the zero point: (0,0) More...
 
int * Array ()
 Returns the struct cast to int* array; use with care! More...
 
const int * Array () const
 Returns the struct cast to const int* array; use with care! More...
 
IntPoint operator- () const
 Returns the inverted point. More...
 
const IntPointoperator+= (const IntPoint &right)
 Adds the given point. More...
 
const IntPointoperator-= (const IntPoint &right)
 Subtracts the given point. More...
 
const IntPointoperator*= (const float &right)
 Multiplies by given scalar. More...
 
const IntPointoperator/= (const float &right)
 Divides by given scalar. More...
 
std::string ToString () const
 Returns a string "[x, y]". More...
 

Public Attributes

int x
 X coord. More...
 
int y
 Y coord. More...
 

Friends

const IntPoint operator+ (const IntPoint &left, const IntPoint &right)
 Adds two points. More...
 
const IntPoint operator- (const IntPoint &left, const IntPoint &right)
 Subtracts two points. More...
 
const IntPoint operator* (const float &left, const IntPoint &right)
 Multiplies point by scalar. More...
 
const IntPoint operator* (const IntPoint &left, const int &right)
 Multiplies point by scalar. More...
 
const IntPoint operator/ (const IntPoint &left, const int &right)
 Divides point by scalar. More...
 

Detailed Description

2D Point with integer coords

Analog of WinAPI's POINT struct.

Member Function Documentation

void Math::IntPoint::LoadZero ( )
inline

Sets the zero point: (0,0)

int* Math::IntPoint::Array ( )
inline

Returns the struct cast to int* array; use with care!

const int* Math::IntPoint::Array ( ) const
inline

Returns the struct cast to const int* array; use with care!

IntPoint Math::IntPoint::operator- ( ) const
inline

Returns the inverted point.

const IntPoint& Math::IntPoint::operator+= ( const IntPoint right)
inline

Adds the given point.

const IntPoint& Math::IntPoint::operator-= ( const IntPoint right)
inline

Subtracts the given point.

const IntPoint& Math::IntPoint::operator*= ( const float &  right)
inline

Multiplies by given scalar.

const IntPoint& Math::IntPoint::operator/= ( const float &  right)
inline

Divides by given scalar.

std::string Math::IntPoint::ToString ( ) const
inline

Returns a string "[x, y]".

Friends And Related Function Documentation

const IntPoint operator+ ( const IntPoint left,
const IntPoint right 
)
friend

Adds two points.

const IntPoint operator- ( const IntPoint left,
const IntPoint right 
)
friend

Subtracts two points.

const IntPoint operator* ( const float &  left,
const IntPoint right 
)
friend

Multiplies point by scalar.

const IntPoint operator* ( const IntPoint left,
const int &  right 
)
friend

Multiplies point by scalar.

const IntPoint operator/ ( const IntPoint left,
const int &  right 
)
friend

Divides point by scalar.

Member Data Documentation

int Math::IntPoint::x

X coord.

int Math::IntPoint::y

Y coord.


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