Math::float2 Class Reference
#include <float2.h>
Detailed Description
A 2-component float vector class.(C) 2007 RadonLabs GmbH
Public Member Functions | |
float2 () | |
default constructor, NOTE: does NOT setup components! | |
float2 (scalar x, scalar y) | |
construct from values | |
float2 (const float2 &rhs) | |
copy constructor | |
void | operator= (const float2 &rhs) |
assignment operator | |
float2 | operator- () const |
flip sign | |
void | operator+= (const float2 &rhs) |
inplace add | |
void | operator-= (const float2 &rhs) |
inplace sub | |
void | operator *= (scalar s) |
inplace scalar multiply | |
float2 | operator+ (const float2 &rhs) const |
add 2 vectors | |
float2 | operator- (const float2 &rhs) const |
subtract 2 vectors | |
float2 | operator * (scalar s) const |
multiply with scalar | |
bool | operator== (const float2 &rhs) const |
equality operator | |
bool | operator!= (const float2 &rhs) const |
inequality operator | |
void | set (scalar x, scalar y) |
set content | |
scalar & | x () |
read/write access to x component | |
scalar & | y () |
read/write access to y component | |
scalar | x () const |
read-only access to x component | |
scalar | y () const |
read-only access to y component | |
scalar | length () const |
return length of vector | |
scalar | lengthsq () const |
return squared length of vector | |
float2 | abs () const |
return compononent-wise absolute | |
bool | any () const |
return true if any components are non-zero | |
bool | all () const |
return true if all components are non-zero | |
template<typename T> | |
T | as () const |
convert to anything | |
Static Public Member Functions | |
static float2 | maximize (const float2 &v0, const float2 &v1) |
return vector made up of largest components of 2 vectors | |
static float2 | minimize (const float2 &v0, const float2 &v1) |
return vector made up of smallest components of 2 vectors | |
static float2 | normalize (const float2 &v) |
return normalized version of vector | |
static float2 | lt (const float2 &v0, const float2 &v1) |
set less-then components to non-zero | |
static float2 | le (const float2 &v0, const float2 &v1) |
set less-or-equal components to non-zero | |
static float2 | gt (const float2 &v0, const float2 &v1) |
set greater-then components to non-zero | |
static float2 | ge (const float2 &v0, const float2 &v1) |
set greater-or-equal components to non-zero |