3D double vector More...
#include <glslmath.h>
Public Member Functions | |
vec3 () | |
default constructor | |
vec3 (const vec3 &v) | |
copy constructor | |
vec3 (const vec2 &v, const double vz=0.0) | |
copy constructor | |
vec3 (const double vx, const double vy, const double vz) | |
component-wise constructor | |
vec3 (const double v) | |
single-component constructor | |
operator vec2 () const | |
cast operator | |
const double * | c_ptr () const |
const pointer to linear array | |
operator const double * () const | |
cast operator to linear array | |
vec3 & | operator+= (const vec3 &v) |
inplace addition | |
vec3 & | operator-= (const vec3 &v) |
inplace subtraction | |
vec3 & | operator*= (double v) |
inplace multiplication | |
vec3 & | operator*= (const vec3 &v) |
inplace multiplication | |
double | length () const |
get vector length | |
double | norm () const |
get squared vector length | |
vec3 | normalize () const |
normalize vector to unit length More... | |
double | dot (const vec3 &v) const |
inner product | |
vec3 | cross (const vec3 &v) const |
cross product (0,0,-1)/(-1,0,0)=(0,1,0) | |
vec3 | reflect (const vec3 &n) const |
reflect incidental vector at normalized surface normal | |
bool | approx (const vec3 &v, const double e=1E-10) const |
test for approximate equality | |
vec2 | xy () const |
swizzeling operator | |
vec3 | zyx () const |
swizzeling operator | |
vec3 | bgr () const |
swizzeling operator | |
vec3 | blend (const vec3 &rgb, double alpha) const |
blending operator | |
operator std::string () | |
string cast operator | |
std::string | to_string (std::string delimiter=", ", int space=0) |
conversion to string | |
Static Public Member Functions | |
static vec3 | normal (const vec3 &a, const vec3 &b, const vec3 &c) |
calculate triangle normal | |
static double | area (const vec3 &a, const vec3 &b, const vec3 &c) |
calculate triangle area | |
Public Attributes | |
union { | |
}; | |
vector components | |
3D double vector
|
inline |
normalize vector to unit length
normalization to unit length