Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | List of all members
b2Vec2 Struct Reference

A 2D column vector. More...

`#include <b2Math.h>`

Inheritance diagram for b2Vec2:

## Public Member Functions
| b2Vec2 ()
| Default constructor does nothing (for performance). More...
| b2Vec2 (float32 x, float32 y)
| Construct using coordinates. More...
void | SetZero ()
| Set this vector to all zeros. More...
void | Set (float32 x_, float32 y_)
| Set this vector to some specified coordinates. More...
b2Vec2 | operator- () const
| Negate this vector. More...
float32 | operator() (int32 i) const
| Read from and indexed element. More...
float32 & | operator() (int32 i)
| Write to an indexed element. More...
void | operator+= (const b2Vec2 &v)
| Add a vector to this vector. More...
void | operator-= (const b2Vec2 &v)
| Subtract a vector from this vector. More...
void | operator*= (float32 a)
| Multiply this vector by a scalar. More...
float32 | Length () const
| Get the length of this vector (the norm). More...
float32 | LengthSquared () const
float32 | Normalize ()
| Convert this vector into a unit vector. Returns the length. More...
bool | IsValid () const
| Does this vector contain finite coordinates? More...
b2Vec2 | Skew () const
| Get the skew vector such that dot(skew_vec, other) == cross(vec, other) More...

## Public Attributes
float32 | x
float32 | y

## Detailed Description

A 2D column vector.

## Constructor & Destructor Documentation

b2Vec2 | ( |  | ) |
| inline

Default constructor does nothing (for performance).

b2Vec2 | ( | float32 | x,
|  | float32 | y
| ) |  |
| inline

Construct using coordinates.

## Member Function Documentation

bool IsValid | ( |  | ) | const
| inline

Does this vector contain finite coordinates?

float32 Length | ( |  | ) | const
| inline

Get the length of this vector (the norm).

float32 LengthSquared | ( |  | ) | const
| inline

Get the length squared. For performance, use this instead of b2Vec2::Length (if possible).

float32 Normalize | ( | void |  | ) |
| inline

Convert this vector into a unit vector. Returns the length.

float32 operator() | ( | int32 | i | ) | const
| inline

Read from and indexed element.

float32& operator() | ( | int32 | i | ) |
| inline

Write to an indexed element.

void operator*= | ( | float32 | a | ) |
| inline

Multiply this vector by a scalar.

void operator+= | ( | const b2Vec2 & | v | ) |
| inline

Add a vector to this vector.

b2Vec2 operator- | ( | void |  | ) | const
| inline

Negate this vector.

void operator-= | ( | const b2Vec2 & | v | ) |
| inline

Subtract a vector from this vector.

void Set | ( | float32 | x_,
|  | float32 | y_
| ) |  |
| inline

Set this vector to some specified coordinates.

void SetZero | ( |  | ) |
| inline

Set this vector to all zeros.

b2Vec2 Skew | ( |  | ) | const
| inline

Get the skew vector such that dot(skew_vec, other) == cross(vec, other)

## Member Data Documentation

float32 x

float32 y

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

- Box2D/Common/b2Math.h