ClanLib  2.3.7
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CL_Pointx< Type > Class Template Reference

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

#include <point.h>

Inheritance diagram for CL_Pointx< Type >:
Inheritance graph
[legend]

Public Types

typedef Type datatype
 

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

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

Detailed Description

template<typename Type>
class CL_Pointx< Type >

2D (x,y) point structure.

These point templates are defined for: int (CL_Point), float (CL_Pointf), double (CL_Pointd)

Member Typedef Documentation

template<typename Type>
typedef Type CL_Vec2< Type >::datatype
inherited

Constructor & Destructor Documentation

template<typename Type>
CL_Pointx< Type >::CL_Pointx ( )
inline
template<typename Type>
CL_Pointx< Type >::CL_Pointx ( Type  x,
Type  y 
)
inline
template<typename Type>
CL_Pointx< Type >::CL_Pointx ( const CL_Pointx< Type > &  p)
inline
template<typename Type>
CL_Pointx< Type >::CL_Pointx ( const CL_Vec2< Type > &  p)
inline

Member Function Documentation

template<typename Type>
CL_Angle CL_Vec2< Type >::angle ( const CL_Vec2< Type > &  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)
template<typename Type>
CL_Angle CL_Vec2< Type >::angle_relative ( const CL_Vec2< Type > &  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)
template<typename Type>
static CL_Pointx<Type> CL_Vec2< Type >::calc_origin ( CL_Origin  origin,
const CL_Sizex< Type > &  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

Referenced by CL_Rectx< int >::apply_alignment().

template<typename Type>
Type CL_Vec2< Type >::distance ( const CL_Vec2< Type > &  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.
template<typename Type>
static Type CL_Vec2< Type >::dot ( const CL_Vec2< Type > &  vector_1,
const CL_Vec2< Type > &  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.
template<typename Type>
Type CL_Vec2< Type >::dot ( const CL_Vec2< Type > &  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.
template<typename Type>
Type CL_Vec2< Type >::length ( ) const
inherited

Returns the length (magnitude) of this vector.

Operates in the native datatype

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

Normalizes a vector.

Operates in the native datatype

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

Normalizes this vector.

Operates in the native datatype

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

!= operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator* ( const CL_Vec2< Type > &  vector) const
inlineinherited

  • operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator* ( Type  value) const
inlineinherited

  • operator.

template<typename Type>
void CL_Vec2< Type >::operator*= ( const CL_Vec2< Type > &  vector)
inlineinherited

*= operator.

template<typename Type>
void CL_Vec2< Type >::operator*= ( Type  value)
inlineinherited

*= operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator+ ( const CL_Vec2< Type > &  vector) const
inlineinherited

  • operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator+ ( Type  value) const
inlineinherited

  • operator.

template<typename Type>
void CL_Vec2< Type >::operator+= ( const CL_Vec2< Type > &  vector)
inlineinherited

+= operator.

template<typename Type>
void CL_Vec2< Type >::operator+= ( Type  value)
inlineinherited

+= operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator- ( const CL_Vec2< Type > &  vector) const
inlineinherited

  • operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator- ( Type  value) const
inlineinherited

  • operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator- ( ) const
inlineinherited

  • operator.

template<typename Type>
void CL_Vec2< Type >::operator-= ( const CL_Vec2< Type > &  vector)
inlineinherited

-= operator.

template<typename Type>
void CL_Vec2< Type >::operator-= ( Type  value)
inlineinherited

-= operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator/ ( const CL_Vec2< Type > &  vector) const
inlineinherited

/ operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator/ ( Type  value) const
inlineinherited

/ operator.

template<typename Type>
void CL_Vec2< Type >::operator/= ( const CL_Vec2< Type > &  vector)
inlineinherited

/= operator.

template<typename Type>
void CL_Vec2< Type >::operator/= ( Type  value)
inlineinherited

/= operator.

template<typename Type>
bool CL_Vec2< Type >::operator== ( const CL_Vec2< Type > &  vector) const
inlineinherited

== operator.

template<typename Type>
const Type& CL_Vec2< Type >::operator[] ( unsigned int  i) const
inlineinherited
template<typename Type>
Type& CL_Vec2< Type >::operator[] ( unsigned int  i)
inlineinherited
template<typename Type>
static CL_Vec2<Type> CL_Vec2< Type >::rotate ( const CL_Vec2< Type > &  vector,
const CL_Vec2< Type > &  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.
template<typename Type>
CL_Vec2<Type>& CL_Vec2< Type >::rotate ( const CL_Vec2< Type > &  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
template<typename Type>
static CL_Vec2<Type> CL_Vec2< Type >::round ( const CL_Vec2< Type > &  vector)
staticinherited

Rounds all components on a vector.

Uses Asymmetric Arithmetic Rounding

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

Rounds all components of this vector.

Uses Asymmetric Arithmetic Rounding

Returns
reference to this object
template<typename Type>
Type CL_Vec2< Type >::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 { ... }
template<typename Type>
Type CL_Vec2< Type >::g
inherited
template<typename Type>
Type CL_Vec2< Type >::r
inherited
template<typename Type>
Type CL_Vec2< Type >::s
inherited
template<typename Type>
Type CL_Vec2< Type >::t
inherited
template<typename Type>
Type CL_Vec2< Type >::x
inherited
template<typename Type>
Type CL_Vec2< Type >::y
inherited

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