|
| | Vec3 () |
| | Construct a vector of all zeros.
|
| |
| template<class U , class V , class W > |
| | Vec3 (const U &v0, const V &v1, const W &v2) |
| | Construct a vector from 3 scalars.
|
| |
| template<class U > |
| | Vec3 (const U &v0) |
| | Construct a vector with every element equal to given value.
|
| |
| template<class U > |
| | Vec3 (const Vec3< U > &a) |
| | Conversion constructor.
|
| |
| T & | operator[] (int i) |
| | Return an element of the vector.
|
| |
| const T & | operator[] (int i) const |
| | Return a const ref to an element of the vector.
|
| |
| T & | operator() (int i) |
| | Return an element of the vector.
|
| |
| const T & | operator() (int i) const |
| | Return a const ref to an element of the vector.
|
| |
| T * | data () |
| | Return pointer to data.
|
| |
| const T * | data () const |
| | Return const pointer to data.
|
| |
| Vec3< T > | operator- () |
| | Return the negative of a vector.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| Vec3< T > & | operator+= (const U &a) |
| | Add a scalar to the Vec3 elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| Vec3< T > & | operator-= (const U &a) |
| | Subtract a scalar from the Vec3 elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| Vec3< T > & | operator*= (const U &a) |
| | Multiply a scalar by the Vec3 elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| Vec3< T > & | operator/= (const U &a) |
| | Divide the Vec3 by a scalar elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| Vec3< T > & | operator+= (const Vec3< U > &a) |
| | Add another Vec3 to the Vec3 elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| Vec3< T > & | operator-= (const Vec3< U > &a) |
| | Subtract another Vec3 from the Vec3 elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| Vec3 & | operator*= (const Vec3< U > &a) |
| | Multiply another Vec3 by the Vec3 elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| Vec3 & | operator/= (const Vec3< U > &a) |
| | Divide this Vec3 by another Vec3 elementwise.
|
| |
| Vec3< T > & | operator= (const T &a) |
| | Assign a scalar value to every element of a Vec3.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| auto | operator+ (const U &a) const -> Vec3< decltype(this->v[0]+a)> |
| | Add a scalar and a Vec3 elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| auto | operator- (const U &a) const -> Vec3< decltype(this->v[0]-a)> |
| | Subtract a scalar from a Vec3 elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| auto | operator* (const U &a) const -> Vec3< decltype(this->v[0] *a)> |
| | Multiply a scalar by a Vec3 elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| auto | operator/ (const U &a) const -> Vec3< decltype(this->v[0]/a)> |
| | Divide a Vec3 by a scalar elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value||std::is_enum< T >::value, bool > = true> |
| Vec3< bool > | operator== (const U &a) const |
| | Evaluate equality of vector elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value||std::is_enum< T >::value, bool > = true> |
| Vec3< bool > | operator!= (const U &a) const |
| | Evaluate inequality of vector elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| auto | operator+ (const Vec3< U > &a) const -> Vec3< decltype(this->v[0]+a[0])> |
| | Add two Vec3s elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| auto | operator- (const Vec3< U > &a) const -> Vec3< decltype(this->v[0]-a[0])> |
| | Subtract two Vec3s elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| auto | operator* (const Vec3< U > &a) const -> Vec3< decltype(this->v[0] *a[0])> |
| | Multiply two Vec3s elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value, bool > = true> |
| auto | operator/ (const Vec3< U > &a) const -> Vec3< decltype(this->v[0]/a[0])> |
| | Divide two Vec3s elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value||std::is_enum< T >::value, bool > = true> |
| Vec3< bool > | operator== (const Vec3< U > &a) const |
| | Evaluate equality of two Vec3's elementwise.
|
| |
| template<class U , std::enable_if_t< std::is_arithmetic< U >::value||std::is_enum< T >::value, bool > = true> |
| Vec3< bool > | operator!= (const Vec3< U > &a) const |
| | Evaluate inequality of two Vec3's elementwise.
|
| |
| constexpr T | mag2 () const |
| | Computes the squared magnitude of the vector.
|
| |
| Real | mag () const |
| | Computes the magnitude of the vector.
|
| |
| Vec3< Real > | unit () const |
| | Returns a unit vector parallel to the vector.
|
| |
| void | normalize () |
| | Normalizes this vector to have unit length.
|
| |
| T | max () const |
| | Return the value of the largest element.
|
| |
| int | argmax () const |
| | Return the index of the largest element.
|
| |
| T | min () const |
| | Return the value of the smallest element.
|
| |
| int | argmin () const |
| | Return the index of the smallest element.
|
| |
| T | sum () const |
| | Return the sum of the elements.
|
| |
| template<class U > |
| auto | dot (const Vec3< U > &a) const |
| | Returns the dot product of this vector with another vector.
|
| |
| template<class U > |
| auto | cross (const Vec3< U > &a) const -> Vec3< decltype(this->v[0]+a[0])> |
| | Returns the cross product of this vector with another vector.
|
| |
| template<class U > |
| Vec3< T > & | operator= (const std::vector< U > &a) |
| | Assign a Vec3 from a std::vector.
|
| |
template<class T>
class criptic::Vec3< T >
Class that represents a mathematical vector.
- Template Parameters
-
| The | type of the three vector |
This class represents a mathematical vector in 3 dimensional space. When the the type of the vector is an arithmetic type, it provides standard algebraic operations.