#include <tb_vector.hpp>
Public Member Functions | |
| TypedVector2 (const SkipInitialization &fastAndStupid) | |
| TypedVector2 (void) | |
| TypedVector2 (const Type valueX, const Type valueY) | |
| TypedVector2 (const Type *componentArray) | |
| TypedVector2 (const TypedVector2 &other) | |
| template<typename FromType > | |
| TypedVector2 (const TypedVector2< FromType > &other) | |
| ~TypedVector2 (void) | |
| TypedVector2 & | operator= (const TypedVector2 &other) |
| bool | operator== (const TypedVector2 &other) const |
| bool | operator!= (const TypedVector2 &other) const |
| operator const Type * (void) const | |
| operator Type * (void) | |
| template<typename ToType > | |
| operator TypedVector2< ToType > (void) const | |
| const Type & | operator[] (const int index) const |
| const Type & | operator[] (const std::size_t &index) const |
| Type & | operator[] (const int index) |
| Type & | operator[] (const std::size_t &index) |
Static Public Member Functions | |
| static TypedVector2 | Zero (void) |
| static TypedVector2 | One (void) |
| static TypedVector2 | Right (void) |
| static TypedVector2 | Left (void) |
| static TypedVector2 | Up (void) |
| static TypedVector2 | Down (void) |
| static Type | Dot (const TypedVector2< Type > &leftSide, const TypedVector2< Type > &rightSide) |
| static TypedVector2 | Normalize (const TypedVector2< Type > &value) |
| static TypedVector2 | Normalize (const TypedVector2< Type > &value, Type &magnitude) |
Public Attributes | |
| union { | |
| Type mComponents [2] | |
| struct { | |
| Type x | |
| Type y | |
| } | |
| }; | |
The TypedVector2 object is a two component mathematical vector of Types packed together with some functionality to perform basic vector math.
|
inlineexplicit |
Constructs a TypedVector2 object leaving the members uninitialized and must be initialized manually before the object is used.
|
inline |
Constructs a default TypedVector2 object with all components set to Type(0).
|
inline |
Constructs a TypedVector2 object with each component initialized with the values provided.
| valueX | The value to initialize the x component as. |
| valueY | The value to initialize the y component as. |
|
inlineexplicit |
Constructs a TypedVector2 object with the supplied Type array, which must contain at least 2 Types.
| componentArray | Must have at least 2 Types, one for each component in the TypedVector2. |
|
inline |
Constructs a TypedVector2 object by copying another TypedVector2 object, each component will be initialized to the value of the other components.
| other | The TypedVector2 object to initialize component values to. |
|
inline |
Nothing needs to happen to destroy a TypedVector2 object.
|
inlinestatic |
Perform a dot product on two TypedVector2 objects, returning the scalar result.
|
inlinestatic |
Take a Vector2 and returns a unit length vector in the same direction.
|
inlinestatic |
Take a Vector2 and returns a unit length vector in the same direction while also returning the original magnitude.
|
inlinestatic |
Creates and returns a TypedVector2 object representing 1, 1.
|
inlineexplicit |
Returns a const Type array of the TypedVector2 components.
|
inlineexplicit |
Returns a Type array of the TypedVector2 components. If modified the internal components will also be modified as well.
|
inlineexplicit |
Casts a Vector to Vector to move from float to double or such.
|
inline |
Inequality operator, returns the opposite of the equality operator, which compares each value in one TypedVector2 object to another using IsEqual to compare the floating point component values.
|
inline |
Assignment operator, sets each component of the TypedVector2 object to the values of the other object.
| other | The TypedVector2 object to set the components to. |
|
inline |
Equality operator, compares each component of the TypedVector2 object to the values of another TypedVector2 returning true if all components are equal, or false if any of the components are not equal.
| other | The TypedVector2 object to compare against. |
|
inline |
Returns a reference to one of the TypedVector2 components by an index provided by the VectorComponent enum. If the reference returned is modified, the internal components will also be modified as well.
|
inline |
Returns a reference to one of the TypedVector2 components by an index provided by the VectorComponent enum.
|
inlinestatic |
Creates and returns a TypedVector2 object representing 0, 0.