ClanLib  2.3.7
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CL_Point Class Reference

2D (x,y) point structure - Integer More...

#include <point.h>

Inheritance diagram for CL_Point:
Inheritance graph
[legend]

Public Types

typedef int datatype
 

Public Member Functions

 CL_Point ()
 
 CL_Point (int x, int y)
 
 CL_Point (const CL_Pointx< int > &p)
 
 CL_Point (const CL_Vec2< int > &p)
 
Attributes
CL_Vec2< int > & normalize ()
 Normalizes this vector. More...
 
int dot (const CL_Vec2< int > &vector) const
 Dot products this vector with an other vector. More...
 
CL_Vec2< int > & round ()
 Rounds all components of this vector. More...
 
CL_Vec2< int > & rotate (const CL_Vec2< int > &hotspot, const CL_Angle &angle)
 Rotate this vector around another point. More...
 
int length () const
 Returns the length (magnitude) of this vector. More...
 
CL_Angle angle (const CL_Vec2< int > &vector) const
 Calculate the angle between this vector and an other vector. More...
 
CL_Angle angle_relative (const CL_Vec2< int > &vector) const
 Calculate the angle between this vector relative to another vector. More...
 
int distance (const CL_Vec2< int > &vector) const
 Calculate the distance between this vector and an other vector. More...
 
int round_value (float value) const
 Rounds a value for the datatype. More...
 
Operators
const int & operator[] (unsigned int i) const
 
int & operator[] (unsigned int i)
 
 operator int * ()
 
 operator int *const () const
 
void operator+= (const CL_Vec2< int > &vector)
 += operator. More...
 
void operator+= (intvalue)
 += operator. More...
 
CL_Vec2< int > operator+ (const CL_Vec2< int > &vector) const
 
  • operator.
More...
 
CL_Vec2< int > operator+ (intvalue) const
 
  • operator.
More...
 
void operator-= (const CL_Vec2< int > &vector)
 -= operator. More...
 
void operator-= (intvalue)
 -= operator. More...
 
CL_Vec2< int > operator- (const CL_Vec2< int > &vector) const
 
  • operator.
More...
 
CL_Vec2< int > operator- (intvalue) const
 
  • operator.
More...
 
CL_Vec2< int > operator- () const
 
  • operator.
More...
 
void operator*= (const CL_Vec2< int > &vector)
 *= operator. More...
 
void operator*= (intvalue)
 *= operator. More...
 
CL_Vec2< int > operator* (const CL_Vec2< int > &vector) const
 
  • operator.
More...
 
CL_Vec2< int > operator* (intvalue) const
 
  • operator.
More...
 
void operator/= (const CL_Vec2< int > &vector)
 /= operator. More...
 
void operator/= (intvalue)
 /= operator. More...
 
CL_Vec2< int > operator/ (const CL_Vec2< int > &vector) const
 / operator. More...
 
CL_Vec2< int > operator/ (intvalue) const
 / operator. More...
 
bool operator== (const CL_Vec2< int > &vector) const
 == operator. More...
 
bool operator!= (const CL_Vec2< int > &vector) const
 != operator. More...
 

Static Public Member Functions

static CL_Pointx< int > calc_origin (CL_Origin origin, const CL_Sizex< int > &size)
 Returns the anchor point for the origin within the dimensions of the size structure. More...
 
static int dot (const CL_Vec2< int > &vector_1, const CL_Vec2< int > &vector_2)
 Dot products a vector with an other vector. More...
 
static CL_Vec2< int > normalize (const CL_Vec2< int > &vector)
 Normalizes a vector. More...
 
static CL_Vec2< int > rotate (const CL_Vec2< int > &vector, const CL_Vec2< int > &hotspot, const CL_Angle &angle)
 Rotate a vector around another point. More...
 
static CL_Vec2< int > round (const CL_Vec2< int > &vector)
 Rounds all components on a vector. More...
 

Public Attributes

union {
   Type   g
 
   Type   t
 
   Type   y
 
}; 
 
union {
   Type   r
 
   Type   s
 
   Type   x
 
}; 
 
int g
 
int r
 
int s
 
int t
 
int x
 
int y
 

Detailed Description

2D (x,y) point structure - Integer

Member Typedef Documentation

typedef int CL_Vec2< int >::datatype
inherited

Constructor & Destructor Documentation

CL_Point::CL_Point ( )
inline
CL_Point::CL_Point ( int  x,
int  y 
)
inline
CL_Point::CL_Point ( const CL_Pointx< int > &  p)
inline
CL_Point::CL_Point ( const CL_Vec2< int > &  p)
inline

Member Function Documentation

CL_Angle CL_Vec2< int >::angle ( const CL_Vec2< int > &  vector) const
inherited

Calculate the angle between this vector and an other vector.

Parameters
vector= Second vector used to calculate angle.
Returns
The angle between the two vectors (between 0 and PI)
CL_Angle CL_Vec2< int >::angle_relative ( const CL_Vec2< int > &  vector) const
inherited

Calculate the angle between this vector relative to another vector.

Parameters
vector= Second vector used to calculate angle.
Returns
The angle between the two vectors (between -PI and PI)
static CL_Pointx<int > CL_Vec2< int >::calc_origin ( CL_Origin  origin,
const CL_Sizex< int > &  size 
)
staticinherited

Returns the anchor point for the origin within the dimensions of the size structure.

Parameters
origin= The origin
size= The size
Returns
The point
int CL_Vec2< int >::distance ( const CL_Vec2< int > &  vector) const
inherited

Calculate the distance between this vector and an other vector.

Parameters
vector= Second vector used to calculate distance.
Returns
The distance between the two vectors.
static int CL_Vec2< int >::dot ( const CL_Vec2< int > &  vector_1,
const CL_Vec2< int > &  vector_2 
)
inlinestaticinherited

Dot products a vector with an other vector.

Operates in the native datatype

Parameters
vector_1= First vector used for the dot product.
vector_2= Second vector used for the dot product.
Returns
The resulting dot product of the two vectors.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

int CL_Vec2< int >::dot ( const CL_Vec2< int > &  vector) const
inlineinherited

Dot products this vector with an other vector.

Operates in the native datatype

Parameters
vectorSecond vector used for the dot product.
Returns
The resulting dot product of the two vectors.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

int CL_Vec2< int >::length ( ) const
inherited

Returns the length (magnitude) of this vector.

Operates in the native datatype

Returns
the length of the vector
static CL_Vec2<int > CL_Vec2< int >::normalize ( const CL_Vec2< int > &  vector)
staticinherited

Normalizes a vector.

Operates in the native datatype

Parameters
vector= Vector to use
Returns
normalized vector
CL_Vec2<int >& CL_Vec2< int >::normalize ( )
inherited

Normalizes this vector.

Operates in the native datatype

Returns
reference to this object
CL_Vec2< int >::operator int * ( )
inlineinherited
CL_Vec2< int >::operator int *const ( ) const
inlineinherited
bool CL_Vec2< int >::operator!= ( const CL_Vec2< int > &  vector) const
inlineinherited

!= operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

CL_Vec2<int > CL_Vec2< int >::operator* ( const CL_Vec2< int > &  vector) const
inlineinherited

  • operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

CL_Vec2<int > CL_Vec2< int >::operator* ( int  value) const
inlineinherited

  • operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

void CL_Vec2< int >::operator*= ( const CL_Vec2< int > &  vector)
inlineinherited

*= operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

void CL_Vec2< int >::operator*= ( int  value)
inlineinherited

*= operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

CL_Vec2<int > CL_Vec2< int >::operator+ ( const CL_Vec2< int > &  vector) const
inlineinherited

  • operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

CL_Vec2<int > CL_Vec2< int >::operator+ ( int  value) const
inlineinherited

  • operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

void CL_Vec2< int >::operator+= ( const CL_Vec2< int > &  vector)
inlineinherited

+= operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

void CL_Vec2< int >::operator+= ( int  value)
inlineinherited

+= operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

CL_Vec2<int > CL_Vec2< int >::operator- ( const CL_Vec2< int > &  vector) const
inlineinherited

  • operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

CL_Vec2<int > CL_Vec2< int >::operator- ( int  value) const
inlineinherited

  • operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

CL_Vec2<int > CL_Vec2< int >::operator- ( ) const
inlineinherited

  • operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

void CL_Vec2< int >::operator-= ( const CL_Vec2< int > &  vector)
inlineinherited

-= operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

void CL_Vec2< int >::operator-= ( int  value)
inlineinherited

-= operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

CL_Vec2<int > CL_Vec2< int >::operator/ ( const CL_Vec2< int > &  vector) const
inlineinherited

/ operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

CL_Vec2<int > CL_Vec2< int >::operator/ ( int  value) const
inlineinherited

/ operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

void CL_Vec2< int >::operator/= ( const CL_Vec2< int > &  vector)
inlineinherited

/= operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

void CL_Vec2< int >::operator/= ( int  value)
inlineinherited

/= operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

bool CL_Vec2< int >::operator== ( const CL_Vec2< int > &  vector) const
inlineinherited

== operator.

References CL_Vec2< Type >::x, and CL_Vec2< Type >::y.

const int & CL_Vec2< int >::operator[] ( unsigned int  i) const
inlineinherited
int & CL_Vec2< int >::operator[] ( unsigned int  i)
inlineinherited
static CL_Vec2<int > CL_Vec2< int >::rotate ( const CL_Vec2< int > &  vector,
const CL_Vec2< int > &  hotspot,
const CL_Angle angle 
)
staticinherited

Rotate a vector around another point.

Parameters
vector= Vector to use
hotspotThe point around which to rotate.
angle= Angle to rotate.
CL_Vec2<int >& CL_Vec2< int >::rotate ( const CL_Vec2< int > &  hotspot,
const CL_Angle angle 
)
inherited

Rotate this vector around another point.

Parameters
hotspotThe point around which to rotate.
angle= Angle to rotate.
Returns
reference to this object
static CL_Vec2<int > CL_Vec2< int >::round ( const CL_Vec2< int > &  vector)
staticinherited

Rounds all components on a vector.

Uses Asymmetric Arithmetic Rounding

Parameters
vector= Vector to use
Returns
The rounded vector
CL_Vec2<int >& CL_Vec2< int >::round ( )
inherited

Rounds all components of this vector.

Uses Asymmetric Arithmetic Rounding

Returns
reference to this object
int CL_Vec2< int >::round_value ( float  value) const
inherited

Rounds a value for the datatype.

For doubles and floats, this function does not round.

Parameters
value= Value to round
Returns
The rounded value

Member Data Documentation

union { ... }
union { ... }
int CL_Vec2< int >::g
inherited
int CL_Vec2< int >::r
inherited
int CL_Vec2< int >::s
inherited
int CL_Vec2< int >::t
inherited
int CL_Vec2< int >::x
inherited
int CL_Vec2< int >::y
inherited

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