The all-important 3-space vector type. Note the lack of virtual members implies no vtable pointer.
More...
|
| | vec3 (real val=0) |
| | Construct a vector by setting all components to `val'. More...
|
| |
| | vec3 (real x, real y, real z=0) |
| | Construct a vector with the given components. More...
|
| |
| | vec3 (const vec3 &v) |
| | Copy constructor. More...
|
| |
| real | x () const |
| |
| real | y () const |
| |
| real | z () const |
| |
| real | x (real v) |
| |
| real | y (real v) |
| |
| real | z (real v) |
| |
| void | setBuff (float *v) const |
| |
| vec3 | operator+ (const vec3 &v) const |
| |
| vec3 | operator- (const vec3 &v) const |
| |
| vec3 | operator* (const vec3 &v) const |
| |
| vec3 | operator/ (const vec3 &v) const |
| |
| vec3 | operator+ (real v) const |
| |
| vec3 | operator- (real v) const |
| |
| vec3 | operator* (real v) const |
| |
| vec3 | operator/ (real v) const |
| |
| vec3 | operator- () const |
| |
| vec3 | abs () const |
| | Return a vector with the absolute value of each component of `this'. More...
|
| |
| vec3 | inv () const |
| | Return a vector with each component of `this' inverted or 0 if already 0. More...
|
| |
| vec3 | sign () const |
| | Return a vector with each component of `this' replaced with 1 if positive otherwise -1. More...
|
| |
| vec3 | cross (const vec3 &v) const |
| | Return the cross product of `this' and `v'. More...
|
| |
| real | dot (const vec3 &v) const |
| | Return the dot product of `this' and `v'. More...
|
| |
| real | len () const |
| | Return the length of `this'. More...
|
| |
| real | lenSq () const |
| | Return the squared length of `this'; this is faster than len(). More...
|
| |
| vec3 | norm () const |
| | Return the normalized version of `this', or a zero vector if `this' is zero-length. More...
|
| |
| real | distTo (const vec3 &v) const |
| | Return the distance from `this' to `v'. More...
|
| |
| real | distToSq (const vec3 &v) const |
| | Return the squared distance from `this' to `v'; this is faster than dist(). More...
|
| |
| vec3 | clamp (const vec3 &v1, const vec3 &v2) const |
| | Return a vector whose components are clamped within the AABB defined by the given vectors. More...
|
| |
| void | setMinVals (const vec3 &v) |
| | Set each component of `this' to minimum of its component and the equivalent in `v'. More...
|
| |
| void | setMaxVals (const vec3 &v) |
| | Set each component of `this' to maximum of its component and the equivalent in `v'. More...
|
| |
| void | normThis () |
| | Normalizes `this', or do nothing if zero-length. More...
|
| |
| vec3 | toPolar () const |
| | Returns an equivalent vector in polar coordinates, assuming `this' was in cartesian coordinates. More...
|
| |
| vec3 | toCylindrical () const |
| | Returns an equivalent vector in cylindrical coordinates, assuming `this' was in cartesian coordinates. More...
|
| |
| vec3 | fromPolar () const |
| | Returns an equivalent vector in cartesian coordinates, assuming `this' was in polar coordinates. More...
|
| |
| vec3 | fromCylindrical () const |
| | Returns an equivalent vector in cartesian coordinates, assuming `this' was in cylindrical coordinates. More...
|
| |
| bool | isZero () const |
| | Returns true if the length of the vector is within dEPSILON of 0. More...
|
| |
| bool | inAABB (const vec3 &minv, const vec3 &maxv) const |
| | Returns true if the vector is within the axis-aligned bounding box defined by the given min and max corners with a 'dEPSILON' margin of error. More...
|
| |
| bool | inOBB (const vec3 ¢er, const vec3 &hx, const vec3 &hy, const vec3 &hz) const |
| | Returns true if the vector is within the oriented bounding box defined by the given center position and half X/Y/Z dimension vectors. More...
|
| |
| bool | inSphere (const vec3 ¢er, real radius) const |
| | Returns true if the vector's distance to `center' is less than or equal to `radius'+`dEPSILON'. More...
|
| |
| bool | onPlane (const vec3 &planept, const vec3 &planenorm) const |
| | Returns true if the vector lies on the plane defined by the point `planept' and normal `planenorm'. More...
|
| |
| bool | isInUnitCube (real margin=0.0) const |
| | Returns true if each component is on the interval [0,1]; this exact within a value of `margin' in the positive and negative directions. More...
|
| |
| bool | isParallel (const vec3 &other) const |
| | Returns true if `other' is parallel with this vector, ie. they represent the same or opposite directions. More...
|
| |
| bool | operator== (const vec3 &v) const |
| | Returns true if the components of `this' and `v' are within `dEPSILON' of one another. More...
|
| |
| bool | operator!= (const vec3 &v) const |
| | Equals the inverse of ==. More...
|
| |
| bool | operator< (const vec3 &v) const |
| |
| bool | operator> (const vec3 &v) const |
| |
| int | cmp (const vec3 &v) const |
| |
| real | angleTo (const vec3 &v) const |
| | Returns the angle between `this' and `v'. More...
|
| |
| vec3 | planeNorm (const vec3 &v2, const vec3 &v3) const |
| | Returns the normal of a plane defined by `this', `v2', and `v3' winding clockwise. More...
|
| |
| vec3 | planeNorm (const vec3 &v2, const vec3 &v3, const vec3 &farv) const |
| | Returns the normal of a plane defined by `this', `v2', and `v3' with `farv' defined as below the plane. More...
|
| |
| real | planeDist (const vec3 &planept, const vec3 &planenorm) const |
| | Returns the distance from `this' to a plane defined by a point on the plane and the plane normal (positive if above plane, negative below) More...
|
| |
| vec3 | planeProject (const vec3 &planept, const vec3 &planenorm) const |
| | Returns the projection of `this' on a plane defined by a point on the plane and the plane normal. More...
|
| |
| int | planeOrder (const vec3 &planenorm, const vec3 &v1, const vec3 &v2) const |
| | Given a plane defined by this and `planenorm', returns the circular ordering of `v1' and `v2'. More...
|
| |
| real | triArea (const vec3 &b, const vec3 &c) const |
| | Returns the area of a triangle defined by `this', `b', and `c'. More...
|
| |
| real | lineDist (vec3 p1, vec3 p2) const |
| | Returns the cylindrical distance from `this' to the line segment `p1'->`p2', or -1 if p1==p2 or `this' isn't within a cylinder with p1->p2 as its centeline. More...
|
| |
| vec3 | lerp (real val, const vec3 &v) const |
| | Linearly interpolate between `this' and `v'. More...
|
| |
| i32 | hash () const |
| |
The all-important 3-space vector type. Note the lack of virtual members implies no vtable pointer.