|
| | Vec3 ()=default |
| | Vec3 (T val) |
| | Construct a vector all of whose components have the given value.
|
| | Vec3 (T x, T y, T z) |
| | Constructor with three arguments, e.g. Vec3d v(1,2,3);.
|
| template<typename Source> |
| | Vec3 (Source *a) |
| | Constructor with array argument, e.g. double a[3]; Vec3d v(a);.
|
| template<typename Source> |
| | Vec3 (const Tuple< 3, Source > &v) |
| | Construct a Vec3 from a 3-Tuple with a possibly different value type.
|
| template<typename Other> |
| | Vec3 (Other val, typename std::enable_if< std::is_arithmetic< Other >::value, Conversion >::type=Conversion{}) |
| | Construct a vector all of whose components have the given value, which may be of an arithmetic type different from this vector's value type.
|
| template<typename Other> |
| | Vec3 (const Vec3< Other > &v) |
| | Construct a Vec3 from another Vec3 with a possibly different value type.
|
| T & | x () |
| | Reference to the component, e.g. v.x() = 4.5f;.
|
| T & | y () |
| T & | z () |
| T | x () const |
| | Get the component, e.g. float f = v.y();.
|
| T | y () const |
| T | z () const |
| T * | asPointer () |
| const T * | asPointer () const |
| T & | operator() (int i) |
| | Alternative indexed reference to the elements.
|
| T | operator() (int i) const |
| | Alternative indexed constant reference to the elements,.
|
| const Vec3< T > & | init (T x=0, T y=0, T z=0) |
| const Vec3< T > & | setZero () |
| | Set "this" vector to zero.
|
| template<typename Source> |
| const Vec3< T > & | operator= (const Vec3< Source > &v) |
| | Assignment operator.
|
| bool | eq (const Vec3< T > &v, T eps=static_cast< T >(1.0e-7)) const |
| | Test if "this" vector is equivalent to vector v with tolerance of eps.
|
| Vec3< T > | operator- () const |
| | Negation operator, for e.g. v1 = -v2;.
|
| template<typename T0, typename T1> |
| const Vec3< T > & | add (const Vec3< T0 > &v1, const Vec3< T1 > &v2) |
| template<typename T0, typename T1> |
| const Vec3< T > & | sub (const Vec3< T0 > &v1, const Vec3< T1 > &v2) |
| template<typename T0, typename T1> |
| const Vec3< T > & | scale (T0 scale, const Vec3< T1 > &v) |
| template<typename T0, typename T1> |
| const Vec3< T > & | div (T0 scale, const Vec3< T1 > &v) |
| T | dot (const Vec3< T > &v) const |
| | Dot product.
|
| T | length () const |
| | Length of the vector.
|
| T | lengthSqr () const |
| Vec3< T > | cross (const Vec3< T > &v) const |
| | Return the cross product of "this" vector and v;.
|
| const Vec3< T > & | cross (const Vec3< T > &v1, const Vec3< T > &v2) |
| | this = v1 cross v2, v1 and v2 must be distinct objects than "this"
|
| template<typename S> |
| const Vec3< T > & | operator*= (S scalar) |
| | Multiply each element of this vector by scalar.
|
| template<typename S> |
| const Vec3< T > & | operator*= (const Vec3< S > &v1) |
| | Multiply each element of this vector by the corresponding element of the given vector.
|
| template<typename S> |
| const Vec3< T > & | operator/= (S scalar) |
| | Divide each element of this vector by scalar.
|
| template<typename S> |
| const Vec3< T > & | operator/= (const Vec3< S > &v1) |
| | Divide each element of this vector by the corresponding element of the given vector.
|
| template<typename S> |
| const Vec3< T > & | operator+= (S scalar) |
| | Add scalar to each element of this vector.
|
| template<typename S> |
| const Vec3< T > & | operator+= (const Vec3< S > &v1) |
| | Add each element of the given vector to the corresponding element of this vector.
|
| template<typename S> |
| const Vec3< T > & | operator-= (S scalar) |
| | Subtract scalar from each element of this vector.
|
| template<typename S> |
| const Vec3< T > & | operator-= (const Vec3< S > &v1) |
| | Subtract each element of the given vector from the corresponding element of this vector.
|
| const Vec3< T > & | exp () |
| const Vec3< T > & | log () |
| T | sum () const |
| | Return the sum of all the vector components.
|
| T | product () const |
| | Return the product of all the vector components.
|
| bool | normalize (T eps=T(1.0e-7)) |
| | this = normalized this
|
| Vec3< T > | unit (T eps=0) const |
| | return normalized this, throws if null vector
|
| Vec3< T > | unit (T eps, T &len) const |
| | return normalized this and length, throws if null vector
|
| Vec3< T > | unitSafe () const |
| | return normalized this, or (1, 0, 0) if this is null vector
|
| T | component (const Vec3< T > &onto, T eps=static_cast< T >(1.0e-7)) const |
| Vec3< T > | projection (const Vec3< T > &onto, T eps=static_cast< T >(1.0e-7)) const |
| Vec3< T > | getArbPerpendicular () const |
| Vec3< T > | sorted () const |
| | Return a vector with the components of this in ascending order.
|
| Vec3< T > | reversed () const |
| | Return the vector (z, y, x)
|
| T | operator[] (IdxT i) const |
|
These are mostly for backwards compatibility with functions that take old-style Vs (which are just arrays).
|
| void | toV (S *v) const |
| | Copies this tuple into an array of a compatible type.
|
| value_type * | asV () |
| | Exposes the internal array. Be careful when using this function.
|
| Tuple | operator+ (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| Tuple | operator- (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| Tuple | operator* (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| Tuple | operator/ (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| Tuple | operator& (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| Tuple | operator| (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| Tuple & | operator+= (Tuple in) |
| | Copies this tuple into an array of a compatible type.
|
| Tuple & | operator-= (Tuple in) |
| | Copies this tuple into an array of a compatible type.
|
| Tuple & | operator*= (Tuple in) |
| | Copies this tuple into an array of a compatible type.
|
| Tuple & | operator/= (Tuple in) |
| | Copies this tuple into an array of a compatible type.
|
| Tuple & | operator&= (Tuple in) |
| | Copies this tuple into an array of a compatible type.
|
| Tuple & | operator|= (Tuple in) |
| | Copies this tuple into an array of a compatible type.
|
| Tuple< SIZE, bool > | operator>= (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| Tuple< SIZE, bool > | operator<= (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| Tuple< SIZE, bool > | operator> (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| Tuple< SIZE, bool > | operator< (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| Tuple< SIZE, bool > | operator== (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| Tuple< SIZE, bool > | operator!= (Tuple in) const |
| | Copies this tuple into an array of a compatible type.
|
| std::string | str () const |
| void | write (std::ostream &os) const |
| | Copies this tuple into an array of a compatible type.
|
| void | read (std::istream &is) |
| | Copies this tuple into an array of a compatible type.
|
| bool | isNan () const |
| | True if a Nan is present in this tuple.
|
| bool | isInfinite () const |
| | True if an Inf is present in this tuple.
|
| bool | isFinite () const |
| | True if no Nan or Inf values are present.
|
| bool | isZero () const |
| | True if all elements are exactly zero.
|
| T | mm [SIZE] |
| | Copies this tuple into an array of a compatible type.
|