![]() |
SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
2D vector template class for standard 2D vector algebra. More...
#include <SLVec2.h>
Public Member Functions | |
SLVec2 () | |
SLVec2 (const T X, const T Y) | |
SLVec2 (const T v[2]) | |
SLVec2 (const SLVec2 &v) | |
void | set (const T X, const T Y) |
void | set (const T v[2]) |
void | set (const SLVec2 &v) |
SLbool | operator== (const SLVec2 &v) const |
SLbool | operator!= (const SLVec2 &v) const |
SLbool | operator<= (const SLVec2 &v) const |
SLbool | operator>= (const SLVec2 &v) const |
SLbool | operator< (const SLVec2 &v) const |
SLbool | operator> (const SLVec2 &v) const |
SLbool | operator<= (const T v) const |
SLbool | operator>= (const T v) const |
SLbool | operator< (const T v) const |
SLbool | operator> (const T v) const |
SLVec2 | operator+ (const SLVec2 &v) const |
SLVec2 | operator- (const SLVec2 &v) const |
SLVec2 | operator- () const |
T | operator* (const SLVec2 &v) const |
SLVec2 | operator* (const T s) const |
SLVec2 | operator/ (const T s) const |
SLVec2 | operator& (const SLVec2 &v) const |
SLVec2 & | operator= (const SLVec2 &v) |
SLVec2 & | operator+= (const SLVec2 &v) |
SLVec2 & | operator-= (const SLVec2 &v) |
SLVec2 & | operator*= (const T s) |
SLVec2 & | operator/= (const T s) |
SLVec2 & | operator&= (const SLVec2 &v) |
void | add (const SLVec2 &a, const SLVec2 &b) |
void | sub (const SLVec2 &a, const SLVec2 &b) |
void | scale (const T s) |
T | dot (const SLVec2 &v) |
T | length () const |
T | lengthSqr () const |
SLVec2 & | normalize () |
void | clampMinMax (const T min, const T max) |
void | toPolar (T &r, T &phiRAD) |
Calculates polar coords with radius & angle phi in radians (-pi < phi < pi) More... | |
void | fromPolar (T r, T phiRAD) |
Calculates the vector from polar coords r & phi in radians (-pi < phi < pi) More... | |
SLVec2 | barycentricCoords (SLVec2 A, SLVec2 B, SLVec2 C) |
Calculate the barycentric coordinate uv of the point within a triangle ABC. More... | |
T | diff (const SLVec2 &v) |
Calculate the absolute to the vector v. More... | |
void | setMin (const SLVec2 &v) |
void | setMax (const SLVec2 &v) |
SLbool | isZero () |
void | print (const char *str=nullptr) |
SLstring | toString (SLstring delimiter=", ", int decimals=2) |
Conversion to string. More... | |
Public Attributes | |
union { | |
struct { | |
T x | |
T y | |
} | |
struct { | |
T comp [2] | |
} | |
}; | |
Static Public Attributes | |
static SLVec2 | ZERO = SLVec2<T>(0,0) |
Friends | |
SLVec2 | operator* (T s, const SLVec2 &v) |
std::ostream & | operator<< (std::ostream &output, const SLVec2 &v) |
2D vector template class for standard 2D vector algebra.
2D vector template class and type definitions for 2D vectors;
Use SLVec2f for a specific float type vector
Use SLVec2d for a specific double type vector
Use SLVec2r for a precision independent real type.
|
inline |
Calculate the absolute to the vector v.
|
inline |
|
inline |
|
inline |
Conversion to string.
Definition at line 129 of file SLVec2.h.
|
friend |
union { ... } |