Polycode::Vector2 Class Reference

2D Vector (convenience wrapper around Vector3). More...

List of all members.

Public Member Functions

 Vector2 (Number x, Number y)
 Create from x,y,z coordinates.
 Vector2 ()
 Default constructor.
void set (Number x, Number y)
 Sets the vector from x,y,z coordinates.
Number distance (const Vector2 &vec2) const
 Returns the distance from this vector to another one.
Number length () const
 Returns the vector length.
Number dot (const Vector2 &u) const
 Returns the dot product with another vector.
Number crossProduct (const Vector2 &vec2) const
 Returns the cross product with another vector.
void Normalize ()
 Normalizes the vector.
Operators

Available vector operators.

Vector2 operator* (const Number val) const
Vector2 operator/ (const Number val) const
Vector2operator= (const Vector2 &v2)
Vector2operator+= (const Vector2 &v2)
Vector2operator-= (const Vector2 &v2)
Vector2 operator+ (const Vector2 &v2) const
bool operator== (const Vector2 &v2)
bool operator!= (const Vector2 &v2)

Public Attributes

Number x
 X coordinate.
Number y
 Y coordinate.

Detailed Description

2D Vector (convenience wrapper around Vector3).


Constructor & Destructor Documentation

Vector2::Vector2 ( Number  x,
Number  y 
)

Create from x,y,z coordinates.

Parameters:
x X coordinate.
y Y coordinate.

Member Function Documentation

Number Polycode::Vector2::crossProduct ( const Vector2 vec2  )  const [inline]

Returns the cross product with another vector.

Parameters:
vec2 Second vector.
Returns:
Cross product with the vector.
Number Polycode::Vector2::distance ( const Vector2 vec2  )  const [inline]

Returns the distance from this vector to another one.

Parameters:
vec2 Second vector.
Returns:
Distance to the other vector.
Number Polycode::Vector2::dot ( const Vector2 u  )  const [inline]

Returns the dot product with another vector.

Returns:
Dor product with the vector.
Number Polycode::Vector2::length (  )  const [inline]

Returns the vector length.

Returns:
Length of the vector.
void Vector2::set ( Number  x,
Number  y 
)

Sets the vector from x,y,z coordinates.

Parameters:
x X coordinate.
y Y coordinate.
Generated on Sat Aug 11 18:04:12 2012 for Polycode by  doxygen 1.6.3