Public Types | Public Member Functions | Static Public Member Functions | Public Attributes

CL_Pointx< Type > Class Template Reference
[clanCore Math]

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

#include <point.h>

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

List of all members.

Public Types

typedef Type datatype

Public Member Functions

 CL_Pointx ()
 CL_Pointx (const CL_Vec2< Type > &p)
 CL_Pointx (const CL_Pointx< Type > &p)
 CL_Pointx (Type x, Type y)
Attributes

CL_Vec2< Type > & normalize ()
 Normalizes this vector.
Type dot (const CL_Vec2< Type > &vector) const
 Dot products this vector with an other vector.
CL_Vec2< Type > & round ()
 Rounds all components of this vector.
CL_Vec2< Type > & rotate (const CL_Vec2< Type > &hotspot, const CL_Angle &angle)
 Rotate this vector around another point.
Type length () const
 Returns the length (magnitude) of this vector.
CL_Angle angle (const CL_Vec2< Type > &vector) const
 Calculate the angle between this vector and an other vector.
CL_Angle angle_relative (const CL_Vec2< Type > &vector) const
 Calculate the angle between this vector relative to another vector.
Type distance (const CL_Vec2< Type > &vector) const
 Calculate the distance between this vector and an other vector.
Type round_value (float value) const
 Rounds a value for the datatype.
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.
void operator+= (Type value)
 += operator.
CL_Vec2< Type > operator+ (const CL_Vec2< Type > &vector) const
 + operator.
CL_Vec2< Type > operator+ (Type value) const
 + operator.
void operator-= (const CL_Vec2< Type > &vector)
 -= operator.
void operator-= (Type value)
 -= operator.
CL_Vec2< Type > operator- (const CL_Vec2< Type > &vector) const
 
  • operator.

CL_Vec2< Type > operator- (Type value) const
 
  • operator.

CL_Vec2< Type > operator- () const
 
  • operator.

void operator*= (const CL_Vec2< Type > &vector)
 *= operator.
void operator*= (Type value)
 *= operator.
CL_Vec2< Type > operator* (const CL_Vec2< Type > &vector) const
 * operator.
CL_Vec2< Type > operator* (Type value) const
 * operator.
void operator/= (const CL_Vec2< Type > &vector)
 /= operator.
void operator/= (Type value)
 /= operator.
CL_Vec2< Type > operator/ (const CL_Vec2< Type > &vector) const
 / operator.
CL_Vec2< Type > operator/ (Type value) const
 / operator.
bool operator== (const CL_Vec2< Type > &vector) const
 == operator.
bool operator!= (const CL_Vec2< Type > &vector) const
 != operator.

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.
static Type dot (const CL_Vec2< Type > &vector_1, const CL_Vec2< Type > &vector_2)
 Dot products a vector with an other vector.
static CL_Vec2< Type > normalize (const CL_Vec2< Type > &vector)
 Normalizes a vector.
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.
static CL_Vec2< Type > round (const CL_Vec2< Type > &vector)
 Rounds all components on a vector.

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 
) [static, inherited]

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

Parameters:
origin = The origin
size = The size
Returns:
The point
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>
Type CL_Vec2< Type >::dot ( const CL_Vec2< Type > &  vector  )  const [inline, inherited]

Dot products this vector with an other vector.

Operates in the native datatype

Parameters:
vector Second vector used for the dot product.
Returns:
The resulting dot product of the two vectors.
template<typename Type>
static Type CL_Vec2< Type >::dot ( const CL_Vec2< Type > &  vector_1,
const CL_Vec2< Type > &  vector_2 
) [inline, static, inherited]

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 >::length (  )  const [inherited]

Returns the length (magnitude) of this vector.

Operates in the native datatype

Returns:
the length of the 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>
static CL_Vec2<Type> CL_Vec2< Type >::normalize ( const CL_Vec2< Type > &  vector  )  [static, inherited]

Normalizes a vector.

Operates in the native datatype

Parameters:
vector = Vector to use
Returns:
normalized vector
template<typename Type>
CL_Vec2< Type >::operator Type * (  )  [inline, inherited]
template<typename Type>
CL_Vec2< Type >::operator Type *const (  )  const [inline, inherited]
template<typename Type>
bool CL_Vec2< Type >::operator!= ( const CL_Vec2< Type > &  vector  )  const [inline, inherited]

!= operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator* ( const CL_Vec2< Type > &  vector  )  const [inline, inherited]

* operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator* ( Type  value  )  const [inline, inherited]

* operator.

template<typename Type>
void CL_Vec2< Type >::operator*= ( const CL_Vec2< Type > &  vector  )  [inline, inherited]

*= operator.

template<typename Type>
void CL_Vec2< Type >::operator*= ( Type  value  )  [inline, inherited]

*= operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator+ ( const CL_Vec2< Type > &  vector  )  const [inline, inherited]

+ operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator+ ( Type  value  )  const [inline, inherited]

+ operator.

template<typename Type>
void CL_Vec2< Type >::operator+= ( const CL_Vec2< Type > &  vector  )  [inline, inherited]

+= operator.

template<typename Type>
void CL_Vec2< Type >::operator+= ( Type  value  )  [inline, inherited]

+= operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator- ( const CL_Vec2< Type > &  vector  )  const [inline, inherited]

  • operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator- ( Type  value  )  const [inline, inherited]

  • operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator- (  )  const [inline, inherited]

  • operator.

template<typename Type>
void CL_Vec2< Type >::operator-= ( const CL_Vec2< Type > &  vector  )  [inline, inherited]

-= operator.

template<typename Type>
void CL_Vec2< Type >::operator-= ( Type  value  )  [inline, inherited]

-= operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator/ ( const CL_Vec2< Type > &  vector  )  const [inline, inherited]

/ operator.

template<typename Type>
CL_Vec2<Type> CL_Vec2< Type >::operator/ ( Type  value  )  const [inline, inherited]

/ operator.

template<typename Type>
void CL_Vec2< Type >::operator/= ( const CL_Vec2< Type > &  vector  )  [inline, inherited]

/= operator.

template<typename Type>
void CL_Vec2< Type >::operator/= ( Type  value  )  [inline, inherited]

/= operator.

template<typename Type>
bool CL_Vec2< Type >::operator== ( const CL_Vec2< Type > &  vector  )  const [inline, inherited]

== operator.

template<typename Type>
const Type& CL_Vec2< Type >::operator[] ( unsigned int  i  )  const [inline, inherited]
template<typename Type>
Type& CL_Vec2< Type >::operator[] ( unsigned int  i  )  [inline, inherited]
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 
) [static, inherited]

Rotate a vector around another point.

Parameters:
vector = Vector to use
hotspot The 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:
hotspot The 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  )  [static, inherited]

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 { ... } [inherited]
union { ... } [inherited]
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: