SeExpr

Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
SeExpr2::Vec< T, d, ref > Class Template Reference

`#include <Vec.h>`

## Classes
struct | INVALID_WITH_DIMENSION
struct | INVALID_WITH_VECTOR_REFERENCE
struct | INVALID_WITH_VECTOR_VALUE

## Public Types
typedef Vec< T, d, false > | T_VEC_VALUE
typedef Vec< T, d, true > | T_VEC_REF

## Public Member Functions
| Vec (T *raw, INVALID_WITH_VECTOR_VALUE u=(TYPENAME my_enable_if< ref, INVALID_WITH_VECTOR_VALUE >::TYPE()))
| Initialize vector to be reference to plain raw data. More...
| Vec (INVALID_WITH_VECTOR_REFERENCE u=(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE >::TYPE()))
| Empty constructor (this is invalid for a reference type) More...
| Vec (T v0, INVALID_WITH_VECTOR_REFERENCE u=(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE >::TYPE()))
| Convenience constant vector initialization (valid for any d) More...
| Vec (T v1, T v2, INVALID_WITH_VECTOR_REFERENCE u=(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE >::TYPE()))
| Convenience 2 vector initialization (only for d==2) More...
| Vec (T v1, T v2, T v3, INVALID_WITH_VECTOR_REFERENCE u=(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE >::TYPE()))
| Convenience 3 vector initialization (only for d==3) More...
| Vec (T v1, T v2, T v3, T v4, INVALID_WITH_VECTOR_REFERENCE u=(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE >::TYPE()))
| Convenience 4 vector initialization (only for d==4) More...
template<class T2 , bool refother>
| Vec (const Vec< T2, d, refother > &other, INVALID_WITH_VECTOR_REFERENCE u=(TYPENAME my_enable_if<!ref &&refother !=ref, INVALID_WITH_VECTOR_REFERENCE >::TYPE()))
| Copy construct. Only valid if we are not going to be a reference data! More...
template<class T2 , bool refother>
Vec & | operator= (const Vec< T2, d, refother > &other)
template<class Tother , bool refother>
bool | operator== (const Vec< Tother, d, refother > &other) const
template<class Tother , bool refother>
bool | operator!= (const Vec< Tother, d, refother > &other) const
T & | operator[] (const int i)
const T & | operator[] (const int i) const
T | length2 () const
| Square of euclidean (2) norm. More...
T | length () const
| Euclidean (2) norm. More...
T | normalize ()
| Normalize in place and return the 2-norm before normalization. More...
Vec< T, d, false > | normalized () const
| Return a copy of the vector that is normalized. More...
Vec & | operator/= (const T val)
Vec & | operator*= (const T val)
template<bool refother>
Vec & | operator+= (const Vec< T, d, refother > &other)
template<bool refother>
Vec & | operator-= (const Vec< T, d, refother > &other)
template<bool refother>
Vec & | operator*= (const Vec< T, d, refother > &other)
template<bool refother>
Vec & | operator/= (const Vec< T, d, refother > &other)
T_VEC_VALUE | operator- () const
template<bool refother>
bool | operator== (const Vec< T, d, refother > &other) const
template<bool refother>
bool | operator!= (const Vec< T, d, refother > &other) const
T_VEC_VALUE | operator* (T s) const
T_VEC_VALUE | operator/ (T s) const
template<bool refother>
T_VEC_VALUE | operator+ (const Vec< T, d, refother > &other) const
template<bool refother>
T_VEC_VALUE | operator- (const Vec< T, d, refother > &other) const
template<bool refother>
T_VEC_VALUE | operator* (const Vec< T, d, refother > &other) const
template<bool refother>
T_VEC_VALUE | operator/ (const Vec< T, d, refother > &other) const
template<bool refother>
T | dot (const Vec< T, d, refother > &o) const
template<bool refother>
T_VEC_VALUE | cross (const Vec< T, 3, refother > &o) const
T_VEC_VALUE | orthogonal () const
template<bool refother>
T | angle (const Vec< T, 3, refother > &o) const
template<bool refother>
T_VEC_VALUE | rotateBy (const Vec< T, 3, refother > &axis, T angle) const

## Static Public Member Functions
template<class T2 >
static Vec< T, d, false > | copy (T2 *raw, INVALID_WITH_VECTOR_REFERENCE u=(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE >::TYPE()))
| Initialize vector value using raw memory. More...

## Private Attributes
static_if< ref, T *, T[d]>::TYPE | x
| internal data (either an explicit arary or a pointer to raw data) More...

## Friends
T_VEC_VALUE | operator* (T s, const Vec &v)

## Detailed Description

### template<class T, int d, bool ref = false>
class SeExpr2::Vec< T, d, ref >

Vec class, generic dimension vector class can also point to data if the template argument ref is true

Definition at line 98 of file Vec.h.

## Member Typedef Documentation

## ◆ T_VEC_REF

template<class T, int d, bool ref = false>

typedef Vec<T, d, true> SeExpr2::Vec< T, d, ref >::T_VEC_REF

Definition at line 109 of file Vec.h.

## ◆ T_VEC_VALUE

template<class T, int d, bool ref = false>

typedef Vec<T, d, false> SeExpr2::Vec< T, d, ref >::T_VEC_VALUE

Definition at line 108 of file Vec.h.

## Constructor & Destructor Documentation

## ◆ Vec() [1/7]

template<class T, int d, bool ref = false>

SeExpr2::Vec< T, d, ref >::Vec | ( | T * | raw,
|  | INVALID_WITH_VECTOR_VALUE | u = `(TYPENAME my_enable_if<ref, INVALID_WITH_VECTOR_VALUE>::TYPE())`
| ) |  |
| inline explicit

Initialize vector to be reference to plain raw data.

Definition at line 122 of file Vec.h.

## ◆ Vec() [2/7]

template<class T, int d, bool ref = false>

SeExpr2::Vec< T, d, ref >::Vec | ( | INVALID_WITH_VECTOR_REFERENCE | u = `(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE>::TYPE())` | ) |
| inline

Empty constructor (this is invalid for a reference type)

Definition at line 126 of file Vec.h.

## ◆ Vec() [3/7]

template<class T, int d, bool ref = false>

SeExpr2::Vec< T, d, ref >::Vec | ( | T | v0,
|  | INVALID_WITH_VECTOR_REFERENCE | u = `(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE>::TYPE())`
| ) |  |
| inline

Convenience constant vector initialization (valid for any d)

Definition at line 129 of file Vec.h.

## ◆ Vec() [4/7]

template<class T, int d, bool ref = false>

SeExpr2::Vec< T, d, ref >::Vec | ( | T | v1,
|  | T | v2,
|  | INVALID_WITH_VECTOR_REFERENCE | u = `(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE>::TYPE())`
| ) |  |
| inline

Convenience 2 vector initialization (only for d==2)

Definition at line 134 of file Vec.h.

## ◆ Vec() [5/7]

template<class T, int d, bool ref = false>

SeExpr2::Vec< T, d, ref >::Vec | ( | T | v1,
|  | T | v2,
|  | T | v3,
|  | INVALID_WITH_VECTOR_REFERENCE | u = `(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE>::TYPE())`
| ) |  |
| inline

Convenience 3 vector initialization (only for d==3)

Definition at line 143 of file Vec.h.

## ◆ Vec() [6/7]

template<class T, int d, bool ref = false>

SeExpr2::Vec< T, d, ref >::Vec | ( | T | v1,
|  | T | v2,
|  | T | v3,
|  | T | v4,
|  | INVALID_WITH_VECTOR_REFERENCE | u = `(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE>::TYPE())`
| ) |  |
| inline

Convenience 4 vector initialization (only for d==4)

Definition at line 154 of file Vec.h.

## ◆ Vec() [7/7]

template<class T, int d, bool ref = false>
template<class T2 , bool refother>

SeExpr2::Vec< T, d, ref >::Vec | ( | const Vec< T2, d, refother > & | other,
|  | INVALID_WITH_VECTOR_REFERENCE | u = `(TYPENAME my_enable_if<!ref && refother != ref, INVALID_WITH_VECTOR_REFERENCE>::TYPE())`
| ) |  |
| inline

Copy construct. Only valid if we are not going to be a reference data!

Copy construct. Only valid if we are not going to be reference data!

Definition at line 173 of file Vec.h.

## Member Function Documentation

## ◆ angle()

template<class T, int d, bool ref = false>
template<bool refother>

T SeExpr2::Vec< T, d, ref >::angle | ( | const Vec< T, 3, refother > & | o | ) | const
| inline

Returns the angle in radians between the current vector and the passed in vector.

Definition at line 354 of file Vec.h.

Referenced by SeExpr2::Vec< double, 3, false >::rotateBy().

## ◆ copy()

template<class T, int d, bool ref = false>
template<class T2 >

static Vec<T, d, false> SeExpr2::Vec< T, d, ref >::copy | ( | T2 * | raw,
|  | INVALID_WITH_VECTOR_REFERENCE | u = `(TYPENAME my_enable_if<!ref, INVALID_WITH_VECTOR_REFERENCE>::TYPE())`
| ) |  |
| inline static

Initialize vector value using raw memory.

Definition at line 113 of file Vec.h.

## ◆ cross()

template<class T, int d, bool ref = false>
template<bool refother>

T_VEC_VALUE SeExpr2::Vec< T, d, ref >::cross | ( | const Vec< T, 3, refother > & | o | ) | const
| inline

Cross product.

Definition at line 338 of file Vec.h.

Referenced by SeExpr2::Vec< double, 3, false >::rotateBy().

## ◆ dot()

template<class T, int d, bool ref = false>
template<bool refother>

T SeExpr2::Vec< T, d, ref >::dot | ( | const Vec< T, d, refother > & | o | ) | const
| inline

Inner product.

Definition at line 330 of file Vec.h.

Referenced by SeExpr2::Vec< double, 3, false >::angle(), SeExpr2::Vec< double, 3, false >::rotateBy(), SeExpr2::saturate(), SeExpr2::voronoi_f1_3d(), and SeExpr2::voronoi_f1f2_3d().

## ◆ length()

template<class T, int d, bool ref = false>

T SeExpr2::Vec< T, d, ref >::length | ( |  | ) | const
| inline

Euclidean (2) norm.

Definition at line 211 of file Vec.h.

Referenced by SeExpr2::Vec< double, 3, false >::angle(), and SeExpr2::rotate().

## ◆ length2()

template<class T, int d, bool ref = false>

T SeExpr2::Vec< T, d, ref >::length2 | ( |  | ) | const
| inline

Square of euclidean (2) norm.

Definition at line 204 of file Vec.h.

Referenced by SeExpr2::Vec< double, 3, false >::length(), and SeExpr2::Vec< double, 3, false >::normalize().

## ◆ normalize()

template<class T, int d, bool ref = false>

T SeExpr2::Vec< T, d, ref >::normalize | ( |  | ) |
| inline

Normalize in place and return the 2-norm before normalization.

Definition at line 214 of file Vec.h.

Referenced by SeExpr2::Vec< double, 3, false >::normalized().

## ◆ normalized()

template<class T, int d, bool ref = false>

Vec<T, d, false> SeExpr2::Vec< T, d, ref >::normalized | ( |  | ) | const
| inline

Return a copy of the vector that is normalized.

Definition at line 227 of file Vec.h.

## ◆ operator!=() [1/2]

template<class T, int d, bool ref = false>
template<bool refother>

bool SeExpr2::Vec< T, d, ref >::operator!= | ( | const Vec< T, d, refother > & | other | ) | const
| inline

Definition at line 282 of file Vec.h.

## ◆ operator!=() [2/2]

template<class T, int d, bool ref = false>
template<class Tother , bool refother>

bool SeExpr2::Vec< T, d, ref >::operator!= | ( | const Vec< Tother, d, refother > & | other | ) | const
| inline

Definition at line 193 of file Vec.h.

## ◆ operator*() [1/2]

template<class T, int d, bool ref = false>
template<bool refother>

T_VEC_VALUE SeExpr2::Vec< T, d, ref >::operator* | ( | const Vec< T, d, refother > & | other | ) | const
| inline

Definition at line 313 of file Vec.h.

## ◆ operator*() [2/2]

template<class T, int d, bool ref = false>

T_VEC_VALUE SeExpr2::Vec< T, d, ref >::operator* | ( | T | s | ) | const
| inline

Definition at line 286 of file Vec.h.

## ◆ operator*=() [1/2]

template<class T, int d, bool ref = false>

Vec& SeExpr2::Vec< T, d, ref >::operator*= | ( | const T | val | ) |
| inline

Definition at line 239 of file Vec.h.

## ◆ operator*=() [2/2]

template<class T, int d, bool ref = false>
template<bool refother>

Vec& SeExpr2::Vec< T, d, ref >::operator*= | ( | const Vec< T, d, refother > & | other | ) |
| inline

Definition at line 257 of file Vec.h.

## ◆ operator+()

template<class T, int d, bool ref = false>
template<bool refother>

T_VEC_VALUE SeExpr2::Vec< T, d, ref >::operator+ | ( | const Vec< T, d, refother > & | other | ) | const
| inline

Definition at line 299 of file Vec.h.

## ◆ operator+=()

template<class T, int d, bool ref = false>
template<bool refother>

Vec& SeExpr2::Vec< T, d, ref >::operator+= | ( | const Vec< T, d, refother > & | other | ) |
| inline

Definition at line 245 of file Vec.h.

## ◆ operator-() [1/2]

template<class T, int d, bool ref = false>

T_VEC_VALUE SeExpr2::Vec< T, d, ref >::operator- | ( |  | ) | const
| inline

Definition at line 268 of file Vec.h.

## ◆ operator-() [2/2]

template<class T, int d, bool ref = false>
template<bool refother>

T_VEC_VALUE SeExpr2::Vec< T, d, ref >::operator- | ( | const Vec< T, d, refother > & | other | ) | const
| inline

Definition at line 306 of file Vec.h.

## ◆ operator-=()

template<class T, int d, bool ref = false>
template<bool refother>

Vec& SeExpr2::Vec< T, d, ref >::operator-= | ( | const Vec< T, d, refother > & | other | ) |
| inline

Definition at line 251 of file Vec.h.

## ◆ operator/() [1/2]

template<class T, int d, bool ref = false>
template<bool refother>

T_VEC_VALUE SeExpr2::Vec< T, d, ref >::operator/ | ( | const Vec< T, d, refother > & | other | ) | const
| inline

Definition at line 320 of file Vec.h.

## ◆ operator/() [2/2]

template<class T, int d, bool ref = false>

T_VEC_VALUE SeExpr2::Vec< T, d, ref >::operator/ | ( | T | s | ) | const
| inline

Definition at line 292 of file Vec.h.

## ◆ operator/=() [1/2]

template<class T, int d, bool ref = false>

Vec& SeExpr2::Vec< T, d, ref >::operator/= | ( | const T | val | ) |
| inline

Definition at line 233 of file Vec.h.

## ◆ operator/=() [2/2]

template<class T, int d, bool ref = false>
template<bool refother>

Vec& SeExpr2::Vec< T, d, ref >::operator/= | ( | const Vec< T, d, refother > & | other | ) |
| inline

Definition at line 263 of file Vec.h.

## ◆ operator=()

template<class T, int d, bool ref = false>
template<class T2 , bool refother>

Vec& SeExpr2::Vec< T, d, ref >::operator= | ( | const Vec< T2, d, refother > & | other | ) |
| inline

Definition at line 180 of file Vec.h.

## ◆ operator==() [1/2]

template<class T, int d, bool ref = false>
template<bool refother>

bool SeExpr2::Vec< T, d, ref >::operator== | ( | const Vec< T, d, refother > & | other | ) | const
| inline

Definition at line 275 of file Vec.h.

## ◆ operator==() [2/2]

template<class T, int d, bool ref = false>
template<class Tother , bool refother>

bool SeExpr2::Vec< T, d, ref >::operator== | ( | const Vec< Tother, d, refother > & | other | ) | const
| inline

Definition at line 186 of file Vec.h.

## ◆ operator[]() [1/2]

template<class T, int d, bool ref = false>

T& SeExpr2::Vec< T, d, ref >::operator[] | ( | const int | i | ) |
| inline

Definition at line 198 of file Vec.h.

## ◆ operator[]() [2/2]

template<class T, int d, bool ref = false>

const T& SeExpr2::Vec< T, d, ref >::operator[] | ( | const int | i | ) | const
| inline

Definition at line 201 of file Vec.h.

## ◆ orthogonal()

template<class T, int d, bool ref = false>

T_VEC_VALUE SeExpr2::Vec< T, d, ref >::orthogonal | ( |  | ) | const
| inline

Return a vector orthogonal to the current vector.

Definition at line 344 of file Vec.h.

## ◆ rotateBy()

template<class T, int d, bool ref = false>
template<bool refother>

T_VEC_VALUE SeExpr2::Vec< T, d, ref >::rotateBy | ( | const Vec< T, 3, refother > & | axis,
|  | T | angle
| ) |  | const
| inline

Returns the vector rotated by the angle given in radians about the given axis. (Axis must be normalized)

Definition at line 366 of file Vec.h.

Referenced by SeExpr2::rotate(), and SeExpr2::up().

## Friends And Related Function Documentation

## ◆ operator*

template<class T, int d, bool ref = false>

T_VEC_VALUE operator* | ( | T | s,
|  | const Vec< T, d, ref > & | v
| ) |  |
| friend

Definition at line 326 of file Vec.h.

## Member Data Documentation

## ◆ x

template<class T, int d, bool ref = false>

static_if<ref, T*, T[d]>::TYPE SeExpr2::Vec< T, d, ref >::x
| private

internal data (either an explicit arary or a pointer to raw data)

Definition at line 105 of file Vec.h.

Referenced by SeExpr2::Vec< double, 3, false >::cross(), SeExpr2::Vec< double, 3, false >::dot(), SeExpr2::Vec< double, 3, false >::length2(), SeExpr2::Vec< double, 3, false >::normalize(), SeExpr2::Vec< double, 3, false >::operator*=(), SeExpr2::Vec< double, 3, false >::operator+=(), SeExpr2::Vec< double, 3, false >::operator-=(), SeExpr2::Vec< double, 3, false >::operator/=(), SeExpr2::Vec< double, 3, false >::operator=(), SeExpr2::Vec< double, 3, false >::operator==(), SeExpr2::Vec< double, 3, false >::operator[](), SeExpr2::Vec< double, 3, false >::orthogonal(), and SeExpr2::Vec< double, 3, false >::Vec().

The documentation for this class was generated from the following file:

- /build/seexpr/src/SeExpr/src/SeExpr2/Vec.h