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

A 2D column vector. More...

#include <b2_math.h>

Public Member Functions

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

Public Attributes

float x
 
float y
 

Detailed Description

A 2D column vector.

Definition at line 41 of file b2_math.h.

Constructor & Destructor Documentation

◆ b2Vec2() [1/2]

b2Vec2::b2Vec2 ( )
inline

Default constructor does nothing (for performance).

Definition at line 44 of file b2_math.h.

◆ b2Vec2() [2/2]

b2Vec2::b2Vec2 ( float  xIn,
float  yIn 
)
inline

Construct using coordinates.

Definition at line 47 of file b2_math.h.

Member Function Documentation

◆ IsValid()

bool b2Vec2::IsValid ( ) const
inline

Does this vector contain finite coordinates?

Definition at line 117 of file b2_math.h.

◆ Length()

float b2Vec2::Length ( ) const
inline

Get the length of this vector (the norm).

Definition at line 89 of file b2_math.h.

◆ LengthSquared()

float b2Vec2::LengthSquared ( ) const
inline

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

Definition at line 96 of file b2_math.h.

◆ Normalize()

float b2Vec2::Normalize ( )
inline

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

Definition at line 102 of file b2_math.h.

◆ operator()() [1/2]

float b2Vec2::operator() ( int32  i) const
inline

Read from and indexed element.

Definition at line 59 of file b2_math.h.

◆ operator()() [2/2]

float& b2Vec2::operator() ( int32  i)
inline

Write to an indexed element.

Definition at line 65 of file b2_math.h.

◆ operator*=()

void b2Vec2::operator*= ( float  a)
inline

Multiply this vector by a scalar.

Definition at line 83 of file b2_math.h.

◆ operator+=()

void b2Vec2::operator+= ( const b2Vec2 v)
inline

Add a vector to this vector.

Definition at line 71 of file b2_math.h.

◆ operator-()

b2Vec2 b2Vec2::operator- ( ) const
inline

Negate this vector.

Definition at line 56 of file b2_math.h.

◆ operator-=()

void b2Vec2::operator-= ( const b2Vec2 v)
inline

Subtract a vector from this vector.

Definition at line 77 of file b2_math.h.

◆ Set()

void b2Vec2::Set ( float  x_,
float  y_ 
)
inline

Set this vector to some specified coordinates.

Definition at line 53 of file b2_math.h.

◆ SetZero()

void b2Vec2::SetZero ( )
inline

Set this vector to all zeros.

Definition at line 50 of file b2_math.h.

◆ Skew()

b2Vec2 b2Vec2::Skew ( ) const
inline

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

Definition at line 123 of file b2_math.h.

Member Data Documentation

◆ x

float b2Vec2::x

Definition at line 128 of file b2_math.h.

◆ y

float b2Vec2::y

Definition at line 128 of file b2_math.h.


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


mvsim
Author(s):
autogenerated on Tue Jul 4 2023 03:08:22