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

#include <point.h>

+ Inheritance diagram for clan::Point:

Public Types

typedef int datatype
 

Public Member Functions

 Point ()
 
 Point (int x, int y)
 
 Point (const Pointx< int > &p)
 
 Point (const Vec2< int > &p)
 
Attributes
Vec2< int > & normalize ()
 Normalizes this vector. More...
 
int dot (const Vec2< int > &vector) const
 Dot products this vector with an other vector. More...
 
Vec2< int > & round ()
 Rounds all components of this vector. More...
 
Vec2< int > & rotate (const Vec2< int > &hotspot, const Angle &angle)
 Rotate this vector around another point. More...
 
bool is_equal (const Vec2< int > &other, intepsilon) const
 Returns true if equal within the bounds of an epsilon. More...
 
int length () const
 Returns the length (magnitude) of this vector. More...
 
Angle angle (const Vec2< int > &vector) const
 Calculate the angle between this vector and an other vector. More...
 
Angle angle_normed (const Vec2< int > &vector) const
 Calculate the angle between this vector and an other vector, where the vectors are unit vectors. More...
 
Angle angle_line (const Vec2< int > &point) const
 Calculate the angle of the line joining this point and other point. More...
 
int distance (const 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
void operator+= (const Vec2< int > &vector)
 += operator. More...
 
void operator+= (intvalue)
 += operator. More...
 
void operator-= (const Vec2< int > &vector)
 -= operator. More...
 
void operator-= (intvalue)
 -= operator. More...
 
Vec2< int > operator- () const
 
  • operator.
More...
 
void operator*= (const Vec2< int > &vector)
 *= operator. More...
 
void operator*= (intvalue)
 *= operator. More...
 
void operator/= (const Vec2< int > &vector)
 /= operator. More...
 
void operator/= (intvalue)
 /= operator. More...
 
bool operator== (const Vec2< int > &vector) const
 == operator. More...
 
bool operator!= (const Vec2< int > &vector) const
 != operator. More...
 
bool operator< (const Vec2< int > &vector) const
 < operator. More...
 

Static Public Member Functions

static Pointx< int > calc_origin (Origin origin, const Sizex< int > &size)
 Returns the anchor point for the origin within the dimensions of the size structure. More...
 
static int dot (const Vec2< int > &vector_1, const Vec2< int > &vector_2)
 Dot products a vector with an other vector. More...
 
static bool is_equal (const Vec2< int > &first, const Vec2< int > &second, intepsilon)
 Returns true if equal within the bounds of an epsilon. More...
 
static Vec2< int > normalize (const Vec2< int > &vector)
 Normalizes a vector. More...
 
static Vec2< int > rotate (const Vec2< int > &vector, const Vec2< int > &hotspot, const Angle &angle)
 Rotate a vector around another point. More...
 
static Vec2< int > round (const Vec2< int > &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
 
}; 
 
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 clan::Vec2< int >::datatype
inherited

Member Function Documentation

Angle clan::Vec2< int >::angle ( const 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
Angle clan::Vec2< int >::angle_line ( const Vec2< int > &  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< int >::angle_normed ( const Vec2< int > &  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<int > clan::Vec2< int >::calc_origin ( Origin  origin,
const 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 clan::Vec2< int >::distance ( const 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 clan::Vec2< int >::dot ( const Vec2< int > &  vector_1,
const 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.
int clan::Vec2< int >::dot ( const 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 clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

static bool clan::Vec2< int >::is_equal ( const Vec2< int > &  first,
const Vec2< int > &  second,
int  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< int >::is_equal ( const Vec2< int > &  other,
int  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)

References clan::Vec2< Type >::is_equal().

int clan::Vec2< int >::length ( ) const
inherited

Returns the length (magnitude) of this vector.

Operates in the native datatype

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

Normalizes a vector.

Operates in the native datatype

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

Normalizes this vector.

Operates in the native datatype

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

!= operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

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

*= operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

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

*= operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

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

+= operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

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

+= operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

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

  • operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

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

-= operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

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

-= operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

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

/= operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

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

/= operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

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

< operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

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

== operator.

References clan::Vec2< Type >::x, and clan::Vec2< Type >::y.

static Vec2<int > clan::Vec2< int >::rotate ( const Vec2< int > &  vector,
const Vec2< int > &  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<int >& clan::Vec2< int >::rotate ( const Vec2< int > &  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<int > clan::Vec2< int >::round ( const Vec2< int > &  vector)
staticinherited

Rounds all components on a vector.

Uses Asymmetric Arithmetic Rounding

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

Rounds all components of this vector.

Uses Asymmetric Arithmetic Rounding

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

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