#include
Inherits INumberVector< F, 3, Vec3_tpl< F > >.
Public Types | |
| typedef INumberVector< F, 3, Vec3_tpl< F > > | NV |
Public Member Functions | |
| ILINE | Vec3_tpl (type_zero) |
| ILINE | Vec3_tpl (F s) |
|
template | |
| ILINE | Vec3_tpl (const Vec3_tpl< F2 > &in) |
| Vec3_tpl (type_min) | |
| Vec3_tpl (type_max) | |
| ILINE | Vec3_tpl (F vx, F vy, F vz) |
| ILINE void | operator() (F vx, F vy, F vz) |
| ILINE Vec3_tpl< F > & | Set (const F xval, const F yval, const F zval) |
| ILINE | Vec3_tpl (const Vec2_tpl< F > &v, F vz=0) |
|
template | |
| ILINE | Vec3_tpl (const Vec2_tpl< F2 > &v, F2 vz=0) |
| ILINE | operator const Vec2_tpl< F > & () const |
| ILINE bool | operator== (const Vec3_tpl< F > &o) const |
| ILINE bool | operator!= (const Vec3_tpl< F > &o) const |
| ILINE Vec3_tpl< F > & | Flip () |
| ILINE bool | IsZeroFast (F e=(F) 0.0003) const |
| ILINE bool | IsUnit (f32 epsilon=VEC_EPSILON) const |
| ILINE void | SetLength (F fLen) |
| force vector length by normalizing it | |
| ILINE void | ClampLength (F maxLength) |
| ILINE F | GetLength2D () const |
| calculate the length of the vector ignoring the z component | |
| ILINE F | GetLengthSquared2D () const |
| calculate the squared length of the vector ignoring the z component | |
| ILINE F | GetSquaredDistance2D (const Vec3_tpl< F > &v) const |
| ILINE F | NormalizeSafe (const Vec3_tpl< F > &safe=Vec3Constants< F >::fVec3_Zero) |
| ILINE Vec3_tpl | GetNormalizedSafe (const Vec3_tpl< F > &safe=Vec3Constants< F >::fVec3_OneX) const |
| return a safely normalized vector - returns safe vector (should be normalised) if original is zero length | |
| ILINE Vec3_tpl | GetPermutated (int new_z) const |
| Permutate coordinates so that z goes to new_z slot. | |
| ILINE F | GetVolume () const |
| ILINE Vec3_tpl< F > | abs () const |
| ILINE void | CheckMin (const Vec3_tpl< F > &other) |
| check for min bounds | |
| ILINE void | CheckMax (const Vec3_tpl< F > &other) |
| check for max bounds | |
| ILINE void | SetOrthogonal (const Vec3_tpl< F > &v) |
| ILINE Vec3_tpl | GetOrthogonal () const |
| ILINE void | SetProjection (const Vec3_tpl &i, const Vec3_tpl &n) |
| ILINE Vec3_tpl | ProjectionOn (const Vec3_tpl &b) const |
| ILINE void | SetReflection (const Vec3_tpl< F > &i, const Vec3_tpl< F > &n) |
| ILINE void | SetLerp (const Vec3_tpl< F > &p, const Vec3_tpl< F > &q, F t) |
| void | SetSlerp (const Vec3_tpl< F > &p, const Vec3_tpl< F > &q, F t) |
| ILINE void | SetQuadraticCurve (const Vec3_tpl< F > &v0, const Vec3_tpl< F > &v1, const Vec3_tpl< F > &v2, F t1) |
| ILINE void | SetCubicCurve (const Vec3_tpl< F > &v0, const Vec3_tpl< F > &v1, const Vec3_tpl< F > &v2, const Vec3_tpl< F > &v3, F t1) |
| ILINE void | SetQuadraticSpline (const Vec3_tpl< F > &v0, const Vec3_tpl< F > &v1, const Vec3_tpl< F > &v2, F t) |
| ILINE Vec3_tpl< F > | GetRotated (const Vec3_tpl< F > &axis, F angle) const |
| ILINE Vec3_tpl< F > | GetRotated (const Vec3_tpl< F > &axis, F cosa, F sina) const |
| ILINE Vec3_tpl< F > | GetRotated (const Vec3_tpl ¢er, const Vec3_tpl< F > &axis, F angle) const |
| ILINE Vec3_tpl< F > | GetRotated (const Vec3_tpl< F > ¢er, const Vec3_tpl< F > &axis, F cosa, F sina) const |
| ILINE Vec3_tpl | CompMul (const Vec3_tpl< F > &rhs) const |
| Component-wise multiplication of two vectors. | |
| ILINE F | Dot (const Vec2_tpl< F > &v) const |
| ILINE Vec3_tpl< F > | Cross (const Vec3_tpl< F > &vec2) const |
| Two methods for a "cross-product" operation. | |
| CRY_DEPRECATED ("Use begin() instead") operator F*() | |
|
template | |
| CRY_DEPRECATED ("Use Vec3_tpl(const Vec3_tpl&) instead") explicit Vec3_tpl(const T *src) | |
| ILINE Vec3_tpl & | zero () |
| ILINE F | len () const |
| ILINE F | len2 () const |
| ILINE Vec3_tpl & | normalize () |
| ILINE Vec3_tpl | normalized () const |
|
template | |
| ILINE Vec3_tpl< F1 > | sub (const Vec3_tpl< F1 > &v) const |
| Vector subtraction. | |
|
template | |
| ILINE Vec3_tpl< F1 > | scale (const F1 k) const |
| Vector scale. | |
|
template | |
| ILINE F1 | dot (const Vec3_tpl< F1 > &v) const |
| Vector dot product. | |
|
template | |
| ILINE Vec3_tpl< F1 > | cross (const Vec3_tpl< F1 > &v) const |
| Vector cross product. | |
| template<> | |
| Vec3_tpl (type_min) | |
| template<> | |
| Vec3_tpl (type_max) | |
Static Public Member Functions | |
| static ILINE bool | IsEquivalent (const Vec3_tpl< F > &v0, const Vec3_tpl< F > &v1, f32 epsilon=VEC_EPSILON) |
| static ILINE Vec3_tpl< F > | CreateProjection (const Vec3_tpl &i, const Vec3_tpl &n) |
| static ILINE Vec3_tpl< F > | CreateReflection (const Vec3_tpl< F > &i, const Vec3_tpl< F > &n) |
| static ILINE Vec3_tpl< F > | CreateLerp (const Vec3_tpl< F > &p, const Vec3_tpl< F > &q, F t) |
| static ILINE Vec3_tpl< F > | CreateSlerp (const Vec3_tpl< F > &p, const Vec3_tpl< F > &q, F t) |
| static ILINE Vec3_tpl< F > | CreateQuadraticCurve (const Vec3_tpl< F > &v0, const Vec3_tpl< F > &v1, const Vec3_tpl< F > &v2, F t) |
| static ILINE Vec3_tpl< F > | CreateCubicCurve (const Vec3_tpl< F > &v0, const Vec3_tpl< F > &v1, const Vec3_tpl< F > &v2, const Vec3_tpl< F > &v3, F t) |
| static ILINE Vec3_tpl< F > | CreateQuadraticSpline (const Vec3_tpl< F > &v0, const Vec3_tpl< F > &v1, const Vec3_tpl< F > &v2, F t) |
General-purpose 3D vector implementation
Template specialization to initialize a vector. Example: Vec3 v0=Vec3(ZERO); Vec3 v1=Vec3(MIN); Vec3 v2=Vec3(MAX);
Constructors and bracket-operator to initialize a vector. Example: Vec3 v0=Vec3(1,2,3); Vec3 v1(1,2,3); v2.Set(1,2,3);
Overloaded arithmetic operator. Example: Vec3 v0=v1*4;
Rotate a vector using angle and axis. Example: Vec3 r=v.GetRotated(axis,angle);
Rotate a vector around a center using angle and axis. Example: Vec3 r=v.GetRotated(axis,angle);
|
inline |
Normalize the vector. Check for null vector - set to the passed in vector (which should be normalised!) if it is null vector.
Cubic-Interpolation between vectors v0,v1,v2,v3. This is repeated linear interpolation from 4 points. If t is in the range [0...1], then the curve goes only through v0 and v3. Example: Vec3 ip; ip.SetCubicCurve( v0,v1,v2,v3, 0.345f );
Linear-Interpolation between Vec3 (lerp). Example: Vec3 r=Vec3::CreateLerp( p, q, 0.345f );
sets a vector orthogonal to the input vector
Example: Vec3 v; v.SetOrthogonal( i );
Project a point/vector on a (virtual) plane. Consider we have a plane going through the origin. Because d=0 we need just the normal. The vector n is assumed to be a unit-vector. Example: Vec3 result=Vec3::CreateProjection( incident, normal );
Quadratic-Interpolation between vectors v0,v1,v2. This is repeated linear interpolation from 3 points and the resulting curve is a parabola. If t is in the range [0...1], then the curve goes only through v0 and v2. Example: Vec3 ip; ip.SetQuadraticCurve( v0,v1,v2, 0.345f );
Spline-Interpolation between vectors v0,v1,v2. This is a variation of a quadratic curve. If t is in the range [0...1], then the spline goes through all 3 points. Example: Vec3 ip; ip.SetSplineInterpolation( v0,v1,v2, 0.345f );
Calculate a reflection vector. Vec3 n is assumed to be a unit-vector. Example: Vec3 result=Vec3::CreateReflection( incident, normal );