|
Nebula
|
#include <vec2.h>
A 2-component float vector class.
Public Member Functions | |
| vec2 ()=default | |
| default constructor, NOTE: does NOT setup components! | |
| vec2 (scalar x) | |
| construct from single value | |
| vec2 (scalar x, scalar y) | |
| construct from values | |
| vec2 (const vec2 &rhs)=default | |
| copy constructor | |
| vec2 | operator- () const |
| flip sign | |
| void | operator+= (const vec2 &rhs) |
| inplace add | |
| void | operator-= (const vec2 &rhs) |
| inplace sub | |
| void | operator*= (scalar s) |
| inplace scalar multiply | |
| vec2 | operator+ (const vec2 &rhs) const |
| add 2 vectors | |
| vec2 | operator- (const vec2 &rhs) const |
| subtract 2 vectors | |
| vec2 | operator* (scalar s) const |
| multiply with scalar | |
| bool | operator== (const vec2 &rhs) const |
| equality operator | |
| bool | operator!= (const vec2 &rhs) const |
| inequality operator | |
| void | set (scalar x, scalar y) |
| set content | |
| void | load (const scalar *ptr) |
| load content from memory | |
| void | store (scalar *ptr) const |
| write content memory | |
| scalar | length () const |
| return length of vector | |
| scalar | lengthsq () const |
| return squared length of vector | |
| vec2 | abs () const |
| return component-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 vec2 | multiply (const vec2 &v0, const vec2 &v1) |
| component wise multiplication | |
| static vec2 | divide (const vec2 &v0, const vec2 &v1) |
| component wise division | |
| static vec2 | maximize (const vec2 &v0, const vec2 &v1) |
| return vector made up of largest components of 2 vectors | |
| static vec2 | minimize (const vec2 &v0, const vec2 &v1) |
| return vector made up of smallest components of 2 vectors | |
| static vec2 | normalize (const vec2 &v) |
| return normalized version of vector | |
| static vec2 | lt (const vec2 &v0, const vec2 &v1) |
| set less-then components to non-zero | |
| static vec2 | le (const vec2 &v0, const vec2 &v1) |
| set less-or-equal components to non-zero | |
| static vec2 | gt (const vec2 &v0, const vec2 &v1) |
| set greater-then components to non-zero | |
| static vec2 | ge (const vec2 &v0, const vec2 &v1) |
| set greater-or-equal components to non-zero | |
Public Attributes | |
| scalar | x |
| scalar | y |
|
default |
default constructor, NOTE: does NOT setup components!
|
inline |
construct from single value
|
default |
copy constructor
|
inline |
return component-wise absolute
|
inline |
return true if all components are non-zero
|
inline |
return true if any components are non-zero
| T Math::vec2::as | ( | ) | const |
convert to anything
set greater-or-equal components to non-zero
set greater-then components to non-zero
set less-or-equal components to non-zero
|
inline |
return length of vector
|
inline |
return squared length of vector
|
inline |
load content from memory
set less-then components to non-zero
return vector made up of largest components of 2 vectors
return vector made up of smallest components of 2 vectors
component wise multiplication
|
inline |
inequality operator
|
inline |
inplace scalar multiply
|
inline |
inplace add
|
inline |
flip sign
|
inline |
inplace sub
|
inline |
equality operator
|
inline |
write content memory
| scalar Math::vec2::x |
| scalar Math::vec2::y |