Files Class List
IPoint2< TYPE > Class Template Reference

Detailed Description

template<typename TYPE>
class cy::IPoint2< TYPE >

2D integer point class

#include <cyIPoint.h>

Public Member Functions

Constructors
 IPoint2 ()
 
 IPoint2 (const TYPE &_x, const TYPE &_y)
 
 IPoint2 (const IPoint2 &p)
 
 IPoint2 (const TYPE &v)
 
 IPoint2 (const IPoint3< TYPE > &p)
 
 IPoint2 (const IPoint4< TYPE > &p)
 
template<typename T >
 IPoint2 (const IPoint2< T > &p)
 
template<typename T >
 IPoint2 (const IPoint3< T > &p)
 
template<typename T >
 IPoint2 (const IPoint4< T > &p)
 
template<int M>
 IPoint2 (const IPoint< TYPE, M > &p)
 
template<typename T , int M>
 IPoint2 (const IPoint< T, M > &p)
 
template<typename P >
 IPoint2 (const P &p)
 
Set & Get value methods
void Zero ()
 
void Get (TYPE *p) const
 
void Set (const TYPE *p)
 
void Set (const TYPE &v)
 
void Set (const TYPE &_x, const TYPE &_y)
 
General methods
TYPE Sum () const
 
bool IsZero () const
 
TYPE Min () const
 
TYPE Max () const
 
int MinID () const
 
int MaxID () const
 
Limit methods
void Clamp (const TYPE &minValue, const TYPE &maxValue)
 
void ClampMin (const TYPE &v)
 
void ClampMax (const TYPE &v)
 
void Abs ()
 
Unary operators
IPoint2 operator- () const
 
Binary operators
IPoint2 operator+ (const IPoint2 &p) const
 
IPoint2 operator- (const IPoint2 &p) const
 
IPoint2 operator* (const IPoint2 &p) const
 
IPoint2 operator/ (const IPoint2 &p) const
 
IPoint2 operator+ (const TYPE &v) const
 
IPoint2 operator- (const TYPE &v) const
 
IPoint2 operator* (const TYPE &v) const
 
IPoint2 operator/ (const TYPE &v) const
 
Assignment operators
const IPoint2operator= (const IPoint2 &p)
 
const IPoint2operator+= (const IPoint2 &p)
 
const IPoint2operator-= (const IPoint2 &p)
 
const IPoint2operator*= (const IPoint2 &p)
 
const IPoint2operator/= (const IPoint2 &p)
 
const IPoint2operator+= (const TYPE &v)
 
const IPoint2operator-= (const TYPE &v)
 
const IPoint2operator*= (const TYPE &v)
 
const IPoint2operator/= (const TYPE &v)
 
Bitwise operators
IPoint2 operator<< (const IPoint2 &p) const
 
IPoint2 operator>> (const IPoint2 &p) const
 
IPoint2 operator& (const IPoint2 &p) const
 
IPoint2 operator| (const IPoint2 &p) const
 
IPoint2 operator^ (const IPoint2 &p) const
 
IPoint2 operator<< (const TYPE &v) const
 
IPoint2 operator>> (const TYPE &v) const
 
IPoint2 operator& (const TYPE &v) const
 
IPoint2 operator| (const TYPE &v) const
 
IPoint2 operator^ (const TYPE &v) const
 
Bitwise Assignment operators
const IPoint2operator<<= (const IPoint2 &p)
 
const IPoint2operator>>= (const IPoint2 &p)
 
const IPoint2operator&= (const IPoint2 &p)
 
const IPoint2operator|= (const IPoint2 &p)
 
const IPoint2operator^= (const IPoint2 &p)
 
const IPoint2operator<<= (const TYPE &v)
 
const IPoint2operator>>= (const TYPE &v)
 
const IPoint2operator&= (const TYPE &v)
 
const IPoint2operator|= (const TYPE &v)
 
const IPoint2operator^= (const TYPE &v)
 
Test operators
bool operator== (const IPoint2 &p) const
 
bool operator!= (const IPoint2 &p) const
 
Access operators
TYPE & operator[] (int i)
 
const TYPE & operator[] (int i) const
 
TYPE & Element (int i)
 
const TYPE & Element (int i) const
 
TYPE * Data ()
 
const TYPE * Data () const
 
Cross product and dot product
TYPE Dot (const IPoint2 &p) const
 
TYPE operator% (const IPoint2 &p) const
 

Public Attributes

Components of the point
TYPE x
 
TYPE y
 

Friends

IPoint2 operator+ (const TYPE v, const IPoint2 &p)
 
IPoint2 operator- (const TYPE v, const IPoint2 &p)
 
IPoint2 operator* (const TYPE v, const IPoint2 &p)
 

Member Function Documentation

§ Zero()

void Zero ( )

Sets the coordinates as zero.

§ Get()

void Get ( TYPE *  p) const

Puts the coordinate values into the array.

§ Set() [1/3]

void Set ( const TYPE *  p)

Sets the coordinates using the values in the given array.

§ Set() [2/3]

void Set ( const TYPE &  v)

Sets all coordinates using the given value.

§ Set() [3/3]

void Set ( const TYPE &  _x,
const TYPE &  _y 
)

Sets the coordinates using the given values.

§ Sum()

TYPE Sum ( ) const

Returns the sum of its components.

§ IsZero()

bool IsZero ( ) const

Returns true if all components are exactly zero.

§ Min()

TYPE Min ( ) const

Returns the sum of its components.

§ Max()

TYPE Max ( ) const

Returns the sum of its components.

§ MinID()

int MinID ( ) const

Returns the sum of its components.

§ MaxID()

int MaxID ( ) const

Returns the sum of its components.

§ Clamp()

void Clamp ( const TYPE &  minValue,
const TYPE &  maxValue 
)

Converts all negative components to positive values.

§ ClampMin()

void ClampMin ( const TYPE &  v)

Converts all negative components to positive values.

§ ClampMax()

void ClampMax ( const TYPE &  v)

Converts all negative components to positive values.

§ Abs()

void Abs ( )

Converts all negative components to positive values.

§ Dot()

TYPE Dot ( const IPoint2< TYPE > &  p) const

Dot product.

§ operator%()

TYPE operator% ( const IPoint2< TYPE > &  p) const

Dot product operator.

Friends And Related Function Documentation

§ operator+

IPoint2 operator+ ( const TYPE  v,
const IPoint2< TYPE > &  p 
)
friend

Addition with a constant.

§ operator-

IPoint2 operator- ( const TYPE  v,
const IPoint2< TYPE > &  p 
)
friend

Subtraction from a constant.

§ operator*

IPoint2 operator* ( const TYPE  v,
const IPoint2< TYPE > &  p 
)
friend

Multiplication with a constant.