Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_Vector2

A 2D Vector class
Contained in: global
Derived from: none
Derived by: none
Group: Core (Math)

#include <ClanLib/core.h>

### public function member index:
### Construction:
`` | `CL_Vector2` | `()`;
`` | `CL_Vector2` | `(`float` `fX`, `float` `fY`)`;
`` | `CL_Vector2` | `(`float` `afCoordinate[2]`)`;
`` | `CL_Vector2` | `(`const` `CL_Vector2`& `rkVector`)`;
### Operators:
``float`&` | `operator``[]` | `(`int` `i`) `const``;
`` | `operator` `float*` | `()`;
``CL_Vector2`&` | `operator``=` | `(`const` `CL_Vector2`& `rkVector`)`;
``bool`` | `operator``==` | `(`const` `CL_Vector2`& `rkVector`) `const``;
``bool`` | `operator``!=` | `(`const` `CL_Vector2`& `rkVector`) `const``;
``bool`` | `operator``<` | `(`const` `CL_Vector2`& `rkVector`) `const``;
``bool`` | `operator``<=` | `(`const` `CL_Vector2`& `rkVector`) `const``;
``bool`` | `operator``>` | `(`const` `CL_Vector2`& `rkVector`) `const``;
``bool`` | `operator``>=` | `(`const` `CL_Vector2`& `rkVector`) `const``;
``CL_Vector2`` | `operator``+` | `(`const` `CL_Vector2`& `rkVector`) `const``;
``CL_Vector2`` | `operator``-` | `(`const` `CL_Vector2`& `rkVector`) `const``;
``CL_Vector2`` | `operator``*` | `(`float` `fScalar`) `const``;
``CL_Vector2`` | `operator``/` | `(`float` `fScalar`) `const``;
``CL_Vector2`` | `operator``-` | `() `const``;
``CL_Vector2`&` | `operator``+=` | `(`const` `CL_Vector2`& `rkVector`)`;
``CL_Vector2`&` | `operator``-=` | `(`const` `CL_Vector2`& `rkVector`)`;
``CL_Vector2`&` | `operator``*=` | `(`float` `fScalar`)`;
``CL_Vector2`&` | `operator``/=` | `(`float` `fScalar`)`;
### Attributes:
``void`` | `set_fuzz` | `()`;
``void`` | `disable_fuzz` | `()`;
``bool`` | `get_fuzz` | `()`;
``float`` | `length` | `() `const``;
``float`` | `squared_length` | `() `const``;
``float`` | `dot` | `(`const` `CL_Vector2`& `rkVector`) `const``;
``float`` | `unitize` | `(`float` `fTolerance` = 1e-06f)`;
``CL_Vector2`` | `cross` | `() `const``;
``CL_Vector2`` | `unit_cross` | `() `const``;

## Description:

CL_Vector2 provides a 2D vector class.
This is different from {link CL_Vector CL_Vector.html}

## Function Member Descriptions:

CL_Vector2::CL_Vector2 - Default constructor
`` `CL_Vector2``()`;

CL_Vector2::CL_Vector2 - Constructor with info
`` `CL_Vector2``(`float` `fX`, `float` `fY`)`;

> fX - The X coordinate.
> fY - The Y coordinate.

CL_Vector2::CL_Vector2 - FIXME!
`` `CL_Vector2``(`float` `afCoordinate[2]`)`;

CL_Vector2::CL_Vector2 - Copy constructor
`` `CL_Vector2``(`const` `CL_Vector2`& `rkVector`)`;

> rkVector = Vector to copy

CL_Vector2::cross - Cross
``CL_Vector2`` `cross``() `const``;

> FIXME
> Returns - Return y,-x

CL_Vector2::disable_fuzz - Disable Fuzzy arithmatic
``void`` `disable_fuzz``()`;

CL_Vector2::dot - FIXME!!!
``float`` `dot``(`const` `CL_Vector2`& `rkVector`) `const``;

CL_Vector2::get_fuzz - Using fuzzy arimatic
``bool`` `get_fuzz``()`;

> Returns - True if using fuzzy arithmatic

CL_Vector2::length - The length of the vector
``float`` `length``() `const``;

> Return - sqrt(x^2+y^2)

CL_Vector2::operator != - Not-equals operator
``bool`` `operator``!=` `(`const` `CL_Vector2`& `rkVector`) `const``;

> Supports fuzzy arimatic when FUZZ > 0

CL_Vector2::operator * - Multiplication operator
``CL_Vector2`` `operator``*` `(`float` `fScalar`) `const``;

CL_Vector2::operator *= - Multiplication assignment operator
``CL_Vector2`&` `operator``*=` `(`float` `fScalar`)`;

CL_Vector2::operator + - Addition operator
``CL_Vector2`` `operator``+` `(`const` `CL_Vector2`& `rkVector`) `const``;

CL_Vector2::operator += - Addition assignment operator
``CL_Vector2`&` `operator``+=` `(`const` `CL_Vector2`& `rkVector`)`;

CL_Vector2::operator - - Subtraction operator
``CL_Vector2`` `operator``-` `(`const` `CL_Vector2`& `rkVector`) `const``;

CL_Vector2::operator - - Negation operator
``CL_Vector2`` `operator``-` `() `const``;

> Return - The negative of the Vector

CL_Vector2::operator -= - Subtraction assignment operator
``CL_Vector2`&` `operator``-=` `(`const` `CL_Vector2`& `rkVector`)`;

CL_Vector2::operator / - Division operator
``CL_Vector2`` `operator``/` `(`float` `fScalar`) `const``;

CL_Vector2::operator /= - Division assignment operator
``CL_Vector2`&` `operator``/=` `(`float` `fScalar`)`;

CL_Vector2::operator < - Less than operator
``bool`` `operator``<` `(`const` `CL_Vector2`& `rkVector`) `const``;

> Supports fuzzy arimatic when FUZZ > 0

CL_Vector2::operator <= - Less than or equal operator
``bool`` `operator``<=` `(`const` `CL_Vector2`& `rkVector`) `const``;

> Supports fuzzy arimatic when FUZZ > 0

CL_Vector2::operator = - assignment operator
``CL_Vector2`&` `operator``=` `(`const` `CL_Vector2`& `rkVector`)`;

CL_Vector2::operator == - Equivalancy operator
``bool`` `operator``==` `(`const` `CL_Vector2`& `rkVector`) `const``;

> Supports fuzzy arimatic when FUZZ > 0

CL_Vector2::operator > - Greater than operator
``bool`` `operator``>` `(`const` `CL_Vector2`& `rkVector`) `const``;

> Supports fuzzy arimatic when FUZZ > 0

CL_Vector2::operator >= - Greater than or equal operator
``bool`` `operator``>=` `(`const` `CL_Vector2`& `rkVector`) `const``;

> Supports fuzzy arimatic when FUZZ > 0

CL_Vector2::operator [] - Accessor
Use vector V[0] for V.x
Use vector V[1] for V.y
``float`&` `operator``[]` `(`int` `i`) `const``;

> Returns - The requested parameter

CL_Vector2::operator float* - Unknown
`` `operator` `float*` `()`;

CL_Vector2::set_fuzz - Enable Fuzzy arithmatic
``void`` `set_fuzz``()`;

CL_Vector2::squared_length - The squared length of the vector
``float`` `squared_length``() `const``;

> Returns - x^2+y^2

CL_Vector2::unit_cross - Unit Cross
``CL_Vector2`` `unit_cross``() `const``;

> Returns - (y,-x)/sqrt(x^2+y^2)

CL_Vector2::unitize - FIXME!!!
``float`` `unitize``(`float` `fTolerance` = 1e-06f)`;

## Variable Member Descriptions: