|
constexpr | Vec ()=default |
| Default constructor: sets all values to 0. More...
|
|
constexpr | Vec (NoInit) |
| Fast constructor: no initialization. More...
|
|
template<Size NN = N, typename std::enable_if< NN==1, int >::type = 0> |
constexpr | Vec (const ValueType r1) noexcept |
| Specific constructor for 1-element vectors. More...
|
|
template<typename... ArgsT, typename = std::enable_if_t< (std::is_convertible_v<ArgsT, ValueType> && ...) >, typename = std::enable_if_t< (sizeof...(ArgsT) == N && sizeof...(ArgsT) > 1) >> |
constexpr | Vec (ArgsT &&... r) noexcept |
|
template<typename R , typename T , Size NN = N, typename std::enable_if< NN==6, int >::type = 0> |
| Vec (const Vec< 3, R > &a, const Vec< 3, T > &b) |
| Specific constructor for 6-elements vectors, taking two 3-elements vectors. More...
|
|
template<Size NN = N, typename std::enable_if< NN==1, int >::type = 0> |
constexpr void | set (const ValueType r1) noexcept |
| Specific set function for 1-element vectors. More...
|
|
template<typename... ArgsT, typename = std::enable_if_t< (std::is_convertible_v<ArgsT, ValueType> && ...) >, typename = std::enable_if_t< (sizeof...(ArgsT) == N && sizeof...(ArgsT) > 1) >> |
constexpr void | set (const ArgsT... r) noexcept |
|
template<Size N2, class real2 > |
constexpr void | set (const Vec< N2, real2 > &v, ValueType defaultvalue=0) noexcept |
| Specific set from a different size vector (given default value and ignored outside entries) More...
|
|
template<Size NN = N, typename std::enable_if<(NN >1), int >::type = 0> |
constexpr | Vec (const Vec< N-1, ValueType > &v, ValueType r1) noexcept |
| Constructor from an N-1 elements vector and an additional value (added at the end). More...
|
|
constexpr | Vec (const sofa::type::fixed_array< ValueType, N > &p) noexcept |
|
template<Size N2, typename real2 > |
constexpr | Vec (const Vec< N2, real2 > &v) noexcept |
| Constructor from a different size vector (null default value and ignoring outside entries) More...
|
|
template<typename real2 > |
constexpr | Vec (const Vec< N, real2 > &p) noexcept |
|
template<typename real2 > |
constexpr | Vec (const real2 *p) noexcept |
| Constructor from an array of values. More...
|
|
template<Size NN = N, typename std::enable_if<(NN >=1), int >::type = 0> |
constexpr ValueType & | x () noexcept |
| Special access to first element. More...
|
|
template<Size NN = N, typename std::enable_if<(NN >=2), int >::type = 0> |
constexpr ValueType & | y () noexcept |
| Special access to second element. More...
|
|
template<Size NN = N, typename std::enable_if<(NN >=3), int >::type = 0> |
constexpr ValueType & | z () noexcept |
| Special access to third element. More...
|
|
template<Size NN = N, typename std::enable_if<(NN >=4), int >::type = 0> |
constexpr ValueType & | w () noexcept |
| Special access to fourth element. More...
|
|
template<Size NN = N, typename std::enable_if<(NN >=1), int >::type = 0> |
constexpr const ValueType & | x () const noexcept |
| Special const access to first element. More...
|
|
template<Size NN = N, typename std::enable_if<(NN >=2), int >::type = 0> |
constexpr const ValueType & | y () const noexcept |
| Special const access to second element. More...
|
|
template<Size NN = N, typename std::enable_if<(NN >=3), int >::type = 0> |
constexpr const ValueType & | z () const noexcept |
| Special const access to third element. More...
|
|
template<Size NN = N, typename std::enable_if<(NN >=4), int >::type = 0> |
constexpr const ValueType & | w () const noexcept |
| Special const access to fourth element. More...
|
|
template<Size NN = N, typename std::enable_if< NN==1, int >::type = 0> |
constexpr void | operator= (const ValueType r1) noexcept |
| Specific Assignment operator for 1-element vectors. More...
|
|
template<typename real2 > |
constexpr void | operator= (const real2 *p) noexcept |
| Assignment operator from an array of values. More...
|
|
template<Size M, typename real2 > |
constexpr void | operator= (const Vec< M, real2 > &v) noexcept |
| Assignment from a vector with different dimensions. More...
|
|
constexpr void | assign (const ValueType &value) noexcept |
|
constexpr void | clear () noexcept |
| Sets every element to 0. More...
|
|
constexpr void | fill (ValueType r) noexcept |
| Sets every element to r. More...
|
|
constexpr ValueType & | operator() (Size i) noexcept |
| Access to i-th element. More...
|
|
constexpr const ValueType & | operator() (Size i) const noexcept |
| Const access to i-th element. More...
|
|
constexpr const ValueType * | ptr () const noexcept |
| Cast into a const array of values. More...
|
|
constexpr ValueType * | ptr () noexcept |
| Cast into an array of values. More...
|
|
template<Size N2, std::enable_if_t<(N2< N), bool > = true> |
constexpr void | getsub (const Size i, Vec< N2, ValueType > &m) const noexcept |
|
constexpr void | getsub (const Size i, ValueType &m) const noexcept |
|
constexpr Vec< N, ValueType > | mulscalar (const ValueType f) const noexcept |
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr Vec< N, ValueType > | mulscalar (const real2 f) const noexcept |
| Multiplication by a scalar f. More...
|
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr Vec< N, ValueType > | operator* (const real2 f) const noexcept |
|
constexpr void | eqmulscalar (const ValueType f) noexcept |
| In-place multiplication by a scalar f. More...
|
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr void | eqmulscalar (const real2 f) noexcept |
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr void | operator*= (const real2 f) noexcept |
|
constexpr Vec< N, ValueType > | divscalar (const ValueType f) const noexcept |
| Division by a scalar f. More...
|
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr Vec< N, ValueType > | divscalar (const real2 f) const noexcept |
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr Vec< N, ValueType > | operator/ (const real2 f) const noexcept |
|
constexpr void | eqdivscalar (const ValueType f) noexcept |
| In-place division by a scalar f. More...
|
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr void | eqdivscalar (const real2 f) noexcept |
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr void | operator/= (const real2 f) noexcept |
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr ValueType | operator* (const Vec< N, real2 > &v) const noexcept |
| Dot product. More...
|
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr Vec< N, ValueType > | linearProduct (const Vec< N, real2 > &v) const noexcept |
| linear product. More...
|
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr Vec< N, ValueType > | linearDivision (const Vec< N, real2 > &v) const noexcept |
| linear division. More...
|
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr Vec< N, ValueType > | operator+ (const Vec< N, real2 > &v) const noexcept |
| Vector addition. More...
|
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr void | operator+= (const Vec< N, real2 > &v) noexcept |
| In-place vector addition. More...
|
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr Vec< N, ValueType > | operator- (const Vec< N, real2 > &v) const noexcept |
| Vector subtraction. More...
|
|
template<class real2 , std::enable_if_t< std::is_convertible_v< real2, ValueType >, bool > = true> |
constexpr void | operator-= (const Vec< N, real2 > &v) noexcept |
| In-place vector subtraction. More...
|
|
template<typename T = ValueType, std::enable_if_t< !std::is_unsigned_v< T >, int > = 0> |
constexpr Vec< N, ValueType > | operator- () const noexcept |
| Vector negation. More...
|
|
constexpr ValueType | norm2 () const noexcept |
| Squared norm. More...
|
|
ValueType | norm () const noexcept |
| Euclidean norm. More...
|
|
ValueType | lNorm (int l) const |
|
constexpr bool | normalizeWithNorm (ValueType norm, ValueType threshold=std::numeric_limits< ValueType >::epsilon()) noexcept |
|
bool | normalize (ValueType threshold=std::numeric_limits< ValueType >::epsilon()) noexcept |
|
void | normalize (Vec< N, ValueType > failsafe, ValueType threshold=std::numeric_limits< ValueType >::epsilon()) noexcept |
|
Vec< N, ValueType > | normalized () const noexcept |
|
bool | isNormalized (ValueType threshold=std::numeric_limits< ValueType >::epsilon() *(ValueType) 10) const |
| return true if norm()==1 More...
|
|
template<typename R , Size NN = N, typename std::enable_if<(NN==3), int >::type = 0> |
constexpr Vec | cross (const Vec< 3, R > &b) const noexcept |
|
constexpr ValueType | sum () const noexcept |
| sum of all elements of the vector More...
|
|
|
constexpr bool | operator== (const Vec &b) const noexcept |
|
constexpr bool | operator!= (const Vec &b) const noexcept |
|
constexpr reference | operator[] (size_type i) |
|
constexpr const_reference | operator[] (size_type i) const |
|
constexpr const ValueType * | data () const noexcept |
|
constexpr iterator | begin () noexcept |
|
constexpr const_iterator | begin () const noexcept |
|
constexpr iterator | end () noexcept |
|
constexpr const_iterator | end () const noexcept |
|
constexpr reference | front () |
|
constexpr const_reference | front () const |
|
constexpr reference | back () |
|
constexpr const_reference | back () const |
|