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

#include <point.h>

+ Inheritance diagram for clan::Pointf:

Public Types

typedef float datatype
 

Public Member Functions

 Pointf ()
 
 Pointf (float x, float y)
 
 Pointf (const Pointx< float > &p)
 
 Pointf (const Vec2< float > &p)
 
Attributes
Vec2< float > & normalize ()
 Normalizes this vector. More...
 
float dot (const Vec2< float > &vector) const
 Dot products this vector with an other vector. More...
 
Vec2< float > & round ()
 Rounds all components of this vector. More...
 
Vec2< float > & rotate (const Vec2< float > &hotspot, const Angle &angle)
 Rotate this vector around another point. More...
 
bool is_equal (const Vec2< float > &other, floatepsilon) const
 Returns true if equal within the bounds of an epsilon. More...
 
float length () const
 Returns the length (magnitude) of this vector. More...
 
Angle angle (const Vec2< float > &vector) const
 Calculate the angle between this vector and an other vector. More...
 
Angle angle_normed (const Vec2< float > &vector) const
 Calculate the angle between this vector and an other vector, where the vectors are unit vectors. More...
 
Angle angle_line (const Vec2< float > &point) const
 Calculate the angle of the line joining this point and other point. More...
 
float distance (const Vec2< float > &vector) const
 Calculate the distance between this vector and an other vector. More...
 
float round_value (float value) const
 Rounds a value for the datatype. More...
 
Operators
void operator+= (const Vec2< float > &vector)
 += operator. More...
 
void operator+= (floatvalue)
 += operator. More...
 
void operator-= (const Vec2< float > &vector)
 -= operator. More...
 
void operator-= (floatvalue)
 -= operator. More...
 
Vec2< float > operator- () const
 
  • operator.
More...
 
void operator*= (const Vec2< float > &vector)
 *= operator. More...
 
void operator*= (floatvalue)
 *= operator. More...
 
void operator/= (const Vec2< float > &vector)
 /= operator. More...
 
void operator/= (floatvalue)
 /= operator. More...
 
bool operator== (const Vec2< float > &vector) const
 == operator. More...
 
bool operator!= (const Vec2< float > &vector) const
 != operator. More...
 
bool operator< (const Vec2< float > &vector) const
 < operator. More...
 

Static Public Member Functions

static Pointx< float > calc_origin (Origin origin, const Sizex< float > &size)
 Returns the anchor point for the origin within the dimensions of the size structure. More...
 
static float dot (const Vec2< float > &vector_1, const Vec2< float > &vector_2)
 Dot products a vector with an other vector. More...
 
static bool is_equal (const Vec2< float > &first, const Vec2< float > &second, floatepsilon)
 Returns true if equal within the bounds of an epsilon. More...
 
static Vec2< float > normalize (const Vec2< float > &vector)
 Normalizes a vector. More...
 
static Vec2< float > rotate (const Vec2< float > &vector, const Vec2< float > &hotspot, const Angle &angle)
 Rotate a vector around another point. More...
 
static Vec2< float > round (const Vec2< float > &vector)
 Rounds all components on a vector. More...
 

Public Attributes

union {
   Type   clan::Vec2< Type >::r
 
   Type   clan::Vec2< Type >::s
 
   Type   clan::Vec2< Type >::x
 
}; 
 
union {
   Type   clan::Vec2< Type >::g
 
   Type   clan::Vec2< Type >::t
 
   Type   clan::Vec2< Type >::y
 
}; 
 
float g
 
float r
 
float s
 
float t
 
float x
 
float y
 

Detailed Description

2D (x,y) point structure - Float

Member Typedef Documentation

typedef float clan::Vec2< float >::datatype
inherited

Member Function Documentation

Angle clan::Vec2< float >::angle ( const Vec2< float > &  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
Angle clan::Vec2< float >::angle_line ( const Vec2< float > &  point) const
inherited

Calculate the angle of the line joining this point and other point.

Parameters
point= Second point in the line
Returns
The angle
Angle clan::Vec2< float >::angle_normed ( const Vec2< float > &  vector) const
inherited

Calculate the angle between this vector and an other vector, where the vectors are unit vectors.

Parameters
vector= Second vector used to calculate angle.
Returns
The angle between the two vectors
static Pointx<float > clan::Vec2< float >::calc_origin ( Origin  origin,
const Sizex< float > &  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
float clan::Vec2< float >::distance ( const Vec2< float > &  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 float clan::Vec2< float >::dot ( const Vec2< float > &  vector_1,
const Vec2< float > &  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.
float clan::Vec2< float >::dot ( const Vec2< float > &  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.
static bool clan::Vec2< float >::is_equal ( const Vec2< float > &  first,
const Vec2< float > &  second,
float  epsilon 
)
inlinestaticinherited

Returns true if equal within the bounds of an epsilon.

Parameters
first= Value A
second= Value B
epsilon= The epsilon (eg FLT_EPSILON/2, DBL_EPSILON/2)
bool clan::Vec2< float >::is_equal ( const Vec2< float > &  other,
float  epsilon 
) const
inlineinherited

Returns true if equal within the bounds of an epsilon.

Parameters
other= Other value
epsilon= The epsilon (eg FLT_EPSILON/2, DBL_EPSILON/2)
float clan::Vec2< float >::length ( ) const
inherited

Returns the length (magnitude) of this vector.

Operates in the native datatype

Returns
the length of the vector
static Vec2<float > clan::Vec2< float >::normalize ( const Vec2< float > &  vector)
staticinherited

Normalizes a vector.

Operates in the native datatype

Parameters
vector= Vector to use
Returns
normalized vector
Vec2<float >& clan::Vec2< float >::normalize ( )
inherited

Normalizes this vector.

Operates in the native datatype

Returns
reference to this object
bool clan::Vec2< float >::operator!= ( const Vec2< float > &  vector) const
inlineinherited

!= operator.

void clan::Vec2< float >::operator*= ( const Vec2< float > &  vector)
inlineinherited

*= operator.

void clan::Vec2< float >::operator*= ( float  value)
inlineinherited

*= operator.

void clan::Vec2< float >::operator+= ( const Vec2< float > &  vector)
inlineinherited

+= operator.

void clan::Vec2< float >::operator+= ( float  value)
inlineinherited

+= operator.

Vec2<float > clan::Vec2< float >::operator- ( ) const
inlineinherited

  • operator.

void clan::Vec2< float >::operator-= ( const Vec2< float > &  vector)
inlineinherited

-= operator.

void clan::Vec2< float >::operator-= ( float  value)
inlineinherited

-= operator.

void clan::Vec2< float >::operator/= ( const Vec2< float > &  vector)
inlineinherited

/= operator.

void clan::Vec2< float >::operator/= ( float  value)
inlineinherited

/= operator.

bool clan::Vec2< float >::operator< ( const Vec2< float > &  vector) const
inlineinherited

< operator.

bool clan::Vec2< float >::operator== ( const Vec2< float > &  vector) const
inlineinherited

== operator.

static Vec2<float > clan::Vec2< float >::rotate ( const Vec2< float > &  vector,
const Vec2< float > &  hotspot,
const Angle angle 
)
staticinherited

Rotate a vector around another point.

Parameters
vector= Vector to use
hotspotThe point around which to rotate.
angle= Angle to rotate.
Vec2<float >& clan::Vec2< float >::rotate ( const Vec2< float > &  hotspot,
const 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 Vec2<float > clan::Vec2< float >::round ( const Vec2< float > &  vector)
staticinherited

Rounds all components on a vector.

Uses Asymmetric Arithmetic Rounding

Parameters
vector= Vector to use
Returns
The rounded vector
Vec2<float >& clan::Vec2< float >::round ( )
inherited

Rounds all components of this vector.

Uses Asymmetric Arithmetic Rounding

Returns
reference to this object
float clan::Vec2< float >::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 { ... }
float clan::Vec2< float >::g
inherited
float clan::Vec2< float >::r
inherited
float clan::Vec2< float >::s
inherited
float clan::Vec2< float >::t
inherited
float clan::Vec2< float >::x
inherited
float clan::Vec2< float >::y
inherited

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