[AE Engine logo] Public API Reference
Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

aeVector2 Class Reference

A 2D vector. More...

#include <vector2.h>

List of all members.

Public Member Functions

 aeVector2 ()
 Create a new uninitialized vector.

 aeVector2 (float nx, float ny)
 Create a new vector and initialize it to given values.

 aeVector2 (const aeVector2 &v)
 Create a new vector and initialize it to another vector.

aeVector2 & operator+= (const aeVector2 &v1)
 Add another vector to this vector.

aeVector2 & operator-= (const aeVector2 &v1)
 Subtract another vector from this vector.

aeVector2 & operator *= (float s)
 Multiply by scalar float.

aeVector2 & operator/= (float s)
 Divide by scalar float.

aeVector2 operator+ () const
 Unary +.

aeVector2 operator- () const
 Unary - (negate this vector).

void set (float nx, float ny)
 Set this vector to given x, y.

void set (const aeVector2 &v)
 Set this vector to another vector.

aeVector2 cross (const aeVector2 &v1, const aeVector2 &v2)
 Get the cross product of two vectors and store the result in this vector.

float magnitude () const
 Get the magnitude (lenght) of this vector.

aeVector2 unit () const
 Get the unit vector of this vector.

aeVector2 normalize () const
 Normalize this vector.


Public Attributes

float x
 The X component of the vector.

float y
 The Y component of the vector.


Friends

aeVector2 operator+ (const aeVector2 &v1, const aeVector2 &v2)
 Add two vectors.

aeVector2 operator- (const aeVector2 &v1, const aeVector2 &v2)
 Subtract two vectors.

float operator * (const aeVector2 &v1, const aeVector2 &v2)
 Dot product of two vectors.

aeVector2 operator * (const aeVector2 &v1, float s)
 Multiply by scalar float.

aeVector2 operator * (float s, const aeVector2 &v1)
 Multiply by scalar float.

aeVector2 operator * (int s, const aeVector2 &v1)
 Multiply by scalar integer.

aeVector2 operator/ (const aeVector2 &v1, float s)
 Divide by scalar float.

aeVector2 operator/ (const aeVector2 &v1, int s)
 Divide by scalar integer.

bool operator== (const aeVector2 &v1, const aeVector2 &v2)
 Check if two vectors are equal.

bool operator!= (const aeVector2 &v1, const aeVector2 &v2)
 Check if two vectors are not equal.


Detailed Description

A 2D vector.

Definition at line 33 of file vector2.h.


Constructor & Destructor Documentation

aeVector2::aeVector2   [inline]
 

Create a new uninitialized vector.

Definition at line 39 of file vector2.h.

aeVector2::aeVector2 float    nx,
float    ny
[inline]
 

Create a new vector and initialize it to given values.

Parameters:
x The vector's X component.
y The vector's Y component.

Definition at line 47 of file vector2.h.

References x, and y.

aeVector2::aeVector2 const aeVector2 &    v [inline]
 

Create a new vector and initialize it to another vector.

Parameters:
v Vector to initialize this one to.

Definition at line 55 of file vector2.h.

References x, and y.


Member Function Documentation

aeVector2 aeVector2::cross const aeVector2 &    v1,
const aeVector2 &    v2
 

Get the cross product of two vectors and store the result in this vector.

Parameters:
v1 Vector1.
v2 Vector2.

float aeVector2::magnitude   const
 

Get the magnitude (lenght) of this vector.

Returns:
The vector's magnitude.

aeVector2 aeVector2::normalize   const
 

Normalize this vector.

Returns:
The normalized vector.

Referenced by unit().

aeVector2& aeVector2::operator *= float    s [inline]
 

Multiply by scalar float.

Parameters:
s Scalar float
Returns:
This vector * scalar float.

Definition at line 219 of file vector2.h.

aeVector2 aeVector2::operator+   const [inline]
 

Unary +.

Returns:
This vector.

Definition at line 245 of file vector2.h.

aeVector2& aeVector2::operator+= const aeVector2 &    v1 [inline]
 

Add another vector to this vector.

Parameters:
v1 Vector to add.
Returns:
This vector + another vector.

Definition at line 193 of file vector2.h.

aeVector2 aeVector2::operator-   const [inline]
 

Unary - (negate this vector).

Returns:
This vector negated.

Definition at line 253 of file vector2.h.

aeVector2& aeVector2::operator-= const aeVector2 &    v1 [inline]
 

Subtract another vector from this vector.

Parameters:
v1 Vector to subtract.
Returns:
This vector / another vector.

Definition at line 206 of file vector2.h.

aeVector2& aeVector2::operator/= float    s [inline]
 

Divide by scalar float.

Parameters:
s Scalar float.
Returns:
This vector / scalar float.

Definition at line 232 of file vector2.h.

void aeVector2::set const aeVector2 &    v [inline]
 

Set this vector to another vector.

Parameters:
v Vector to set this vector to.

Definition at line 271 of file vector2.h.

void aeVector2::set float    nx,
float    ny
[inline]
 

Set this vector to given x, y.

Parameters:
nx The value to set the x component of this vector to.
ny The value to set the y component of this vector to.

Definition at line 261 of file vector2.h.

aeVector2 aeVector2::unit   const [inline]
 

Get the unit vector of this vector.

This is essentialy the same as Normalize().

See also:
aeVector::Normalize()
Returns:

Definition at line 299 of file vector2.h.

References normalize().


Friends And Related Function Documentation

aeVector2 operator * int    s,
const aeVector2 &    v1
[friend]
 

Multiply by scalar integer.

Parameters:
s Scalar integer.
v1 Vector.
Returns:
Scalar integer * vector

Definition at line 133 of file vector2.h.

aeVector2 operator * float    s,
const aeVector2 &    v1
[friend]
 

Multiply by scalar float.

Parameters:
s Scalar float.
v1 Vector.
Returns:
Scalar float * vector.

Definition at line 121 of file vector2.h.

aeVector2 operator * const aeVector2 &    v1,
float    s
[friend]
 

Multiply by scalar float.

Parameters:
v1 Vector.
s Scalar float.
Returns:
Vector * scalar float.

Definition at line 109 of file vector2.h.

float operator * const aeVector2 &    v1,
const aeVector2 &    v2
[friend]
 

Dot product of two vectors.

Parameters:
v1 Vector1.
v2 Vector2.
Returns:
Vector1 . Vector2.

Definition at line 97 of file vector2.h.

bool operator!= const aeVector2 &    v1,
const aeVector2 &    v2
[friend]
 

Check if two vectors are not equal.

Parameters:
v1 Vector1
v2 Vector2
Returns:
True if Vector1 != Vector2, false if not.

Definition at line 182 of file vector2.h.

aeVector2 operator+ const aeVector2 &    v1,
const aeVector2 &    v2
[friend]
 

Add two vectors.

Parameters:
v1 Vector1.
v2 Vector2.
Returns:
Vector1 + Vector2.

Definition at line 73 of file vector2.h.

aeVector2 operator- const aeVector2 &    v1,
const aeVector2 &    v2
[friend]
 

Subtract two vectors.

Parameters:
v1 Vector1.
v2 Vector2.
Returns:
Vector1 - Vector2.

Definition at line 85 of file vector2.h.

aeVector2 operator/ const aeVector2 &    v1,
int    s
[friend]
 

Divide by scalar integer.

Parameters:
v1 Vector.
s Scalar integer.
Returns:
Vector / scalar integer.

Definition at line 158 of file vector2.h.

aeVector2 operator/ const aeVector2 &    v1,
float    s
[friend]
 

Divide by scalar float.

Parameters:
v1 Vector.
s Scalar float.
Returns:
Vector / scalar float.

Definition at line 145 of file vector2.h.

bool operator== const aeVector2 &    v1,
const aeVector2 &    v2
[friend]
 

Check if two vectors are equal.

Parameters:
v1 Vector1
v2 Vector2
Returns:
True if Vector1 == Vector2, false if not.

Definition at line 170 of file vector2.h.


The documentation for this class was generated from the following file:
AE Engine Public API Reference
Generated on Wed Apr 9 09:43:41 2003 by Doxygen.