cgv
Loading...
Searching...
No Matches
cgv::math::vec< T > Class Template Reference

A column vector class. More...

#include <vec.h>

Inheritance diagram for cgv::math::vec< T >:
cgv::math::qem< T >

Public Types

typedef T value_type
 
typedef T & reference
 
typedef const T & const_reference
 
typedef std::size_t size_type
 
typedef std::ptrdiff_t difference_type
 
typedef T * pointer
 
typedef const T * const_pointer
 
typedef T * iterator
 
typedef const T * const_iterator
 
typedef std::reverse_iterator< iterator > reverse_iterator
 
typedef std::reverse_iterator< const_iterator > const_reverse_iterator
 

Public Member Functions

iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
unsigned size () const
 number of elements
 
unsigned dim () const
 number of elements
 
 vec ()
 standard constructor
 
 vec (unsigned dim, const T &value=T(0))
 creates a vector with dim elements
 
 vec (unsigned dim, const T *marray)
 creates a vector with dim elements from an array
 
 vec (const vec< T > &v)
 copy constructor for vectors with equal element type

 
template<typename S >
 vec (const vec< S > &v)
 copy constructor for vectors with different element type
 
 vec (const T &c0, const T &c1)
 creates a 2d vector (c0,c1)^T
 
 vec (const T &c0, const T &c1, const T &c2)
 creates a 3d vector (c0,c1,c2)^T
 
 vec (const T &c0, const T &c1, const T &c2, const T &c3)
 creates a 4d vector (c0,c1,c2,c3)^T
 
void set (const T &c0, const T &c1)
 set entries of a 2d vector
 
void set (const T &c0, const T &c1, const T &c2)
 set entries of a 3d vector
 
void set (const T &c0, const T &c1, const T &c2, const T &c3)
 set entries of a 4d vector
 
void set_extern_data (unsigned dim, T *data)
 set data pointer to an external data array
 
virtual ~vec ()
 destructor
 
void destruct ()
 
T * data ()
 cast into non const array
 
const T * data () const
 cast into const array
 
vec< T > & operator= (const vec< T > &v)
 assignment of a vector v
 
vec< T > & operator= (const T &s)
 assignment of a scalar s
 
template<typename S >
vec< T > & operator= (const vec< S > &v)
 assignment of a vector v
 
T & operator() (unsigned i)
 element accessor
 
const T & operator() (unsigned i) const
 const element accessor
 
T & operator[] (unsigned i)
 element accessor
 
const T & operator[] (unsigned i) const
 const element accessor
 
T & first ()
 element accessor for the first element
 
const T & first () const
 const element accessor for the first element
 
T & last ()
 element accessor for the flast element
 
const T & last () const
 const element accessor for the last element
 
T & x ()
 element accessor for the first element
 
const T & x () const
 const element accessor for the first element
 
T & y ()
 element accessor for the second element
 
const T & y () const
 const element accessor for the second element
 
T & z ()
 element accessor for the third element
 
const T & z () const
 const element accessor for the third element
 
T & w ()
 element accessor for the fourth element
 
const T & w () const
 const element accessor for the fourth element
 
vec< T > & operator+= (const T &s)
 in place addition of a scalar s
 
vec< T > & operator-= (const T &s)
 in place subtraction by scalar s
 
vec< T > & operator*= (const T &s)
 in place multiplication with s
 
vec< T > & operator/= (const T &s)
 in place division by scalar s
 
template<typename S >
vec< T > & operator+= (const vec< S > &v)
 in place vector addition
 
template<typename S >
vec< T > & operator-= (const vec< S > &v)
 in place vector subtraction
 
template<typename S >
vec< T > & operator*= (const vec< S > &v)
 in place componentwise vector multiplication
 
template<typename S >
vec< T > & operator/= (const vec< S > &v)
 in place componentwise vector division
 
template<typename S >
const vec< T > operator+ (const vec< S > &v) const
 vector addition
 
const vec< T > operator+ (const T &s) const
 componentwise addition of scalar
 
const vec< T > operator- (const T &s) const
 componentwise subtraction of scalar
 
template<typename S >
vec< T > operator- (const vec< S > &v) const
 vector subtraction
 
template<typename S >
const vec< T > operator* (const vec< S > &v) const
 componentwise vector multiplication
 
template<typename S >
const vec< T > operator/ (const vec< S > &v) const
 componentwise vector division
 
vec< T > operator- (void) const
 negates the vector
 
vec< T > operator* (const T &s) const
 multiplication with scalar s
 
vec< T > operator/ (const T &s) const
 divides vector by scalar s
 
void fill (const T &v)
 fill elements of vector with scalar v
 
void zeros ()
 fill the vector with zeros
 
void ones ()
 fill the vector with ones
 
void zeros (unsigned n)
 resize the vector to size n and fills the vector with zeros
 
void ones (unsigned n)
 resize the vector to size n and fills thevector with ones
 
void resize (unsigned dim)
 resize the vector
 
template<typename S >
bool operator== (const vec< S > &v) const
 test for equality
 
template<typename S >
bool operator!= (const vec< S > &v) const
 test for inequality
 
length () const
 length of the vector L2-Norm
 
void abs ()
 componentwise absolute values
 
void ceil ()
 ceil componentwise
 
void floor ()
 floor componentwise
 
void round ()
 round componentwise
 
sqr_length () const
 square length of vector
 
void normalize ()
 normalize the vector using the L2-Norm
 
void safe_normalize ()
 normalize the vector if length is not zero using the L2-Norm
 
vec< T > sub_vec (unsigned ifrom, unsigned size) const
 extracts sub vector beginning at index ifrom with given size
 
void copy (unsigned ifrom, unsigned s, vec< T > &subvec) const
 copy sub vector beginning at index ifrom with given size s into subvec
 
void paste (unsigned ifrom, const vec< T > &v)
 paste v into vector beginning at index pos ifrom
 

Protected Attributes

T * _data
 pointer to _data storage
 
unsigned _size
 number or elements
 
bool data_is_external
 store whether data is not owned by vector
 

Detailed Description

template<typename T>
class cgv::math::vec< T >

A column vector class.

Definition at line 27 of file vec.h.

Member Typedef Documentation

◆ const_iterator

template<typename T >
typedef const T* cgv::math::vec< T >::const_iterator

Definition at line 46 of file vec.h.

◆ const_pointer

template<typename T >
typedef const T* cgv::math::vec< T >::const_pointer

Definition at line 44 of file vec.h.

◆ const_reference

template<typename T >
typedef const T& cgv::math::vec< T >::const_reference

Definition at line 40 of file vec.h.

◆ const_reverse_iterator

template<typename T >
typedef std::reverse_iterator<const_iterator> cgv::math::vec< T >::const_reverse_iterator

Definition at line 48 of file vec.h.

◆ difference_type

template<typename T >
typedef std::ptrdiff_t cgv::math::vec< T >::difference_type

Definition at line 42 of file vec.h.

◆ iterator

template<typename T >
typedef T* cgv::math::vec< T >::iterator

Definition at line 45 of file vec.h.

◆ pointer

template<typename T >
typedef T* cgv::math::vec< T >::pointer

Definition at line 43 of file vec.h.

◆ reference

template<typename T >
typedef T& cgv::math::vec< T >::reference

Definition at line 39 of file vec.h.

◆ reverse_iterator

template<typename T >
typedef std::reverse_iterator<iterator> cgv::math::vec< T >::reverse_iterator

Definition at line 47 of file vec.h.

◆ size_type

template<typename T >
typedef std::size_t cgv::math::vec< T >::size_type

Definition at line 41 of file vec.h.

◆ value_type

template<typename T >
typedef T cgv::math::vec< T >::value_type

Definition at line 38 of file vec.h.

Constructor & Destructor Documentation

◆ vec() [1/8]

template<typename T >
cgv::math::vec< T >::vec ( )
inline

standard constructor

Definition at line 63 of file vec.h.

◆ vec() [2/8]

template<typename T >
cgv::math::vec< T >::vec ( unsigned  dim,
const T &  value = T(0) 
)
inlineexplicit

creates a vector with dim elements

Definition at line 65 of file vec.h.

References cgv::math::vec< T >::_data, cgv::math::vec< T >::_size, cgv::math::vec< T >::data_is_external, and cgv::math::vec< T >::dim().

◆ vec() [3/8]

template<typename T >
cgv::math::vec< T >::vec ( unsigned  dim,
const T *  marray 
)
inline

creates a vector with dim elements from an array

Definition at line 76 of file vec.h.

References cgv::math::vec< T >::_data, cgv::math::vec< T >::_size, cgv::math::vec< T >::data_is_external, and cgv::math::vec< T >::dim().

◆ vec() [4/8]

template<typename T >
cgv::math::vec< T >::vec ( const vec< T > &  v)
inline

copy constructor for vectors with equal element type

Definition at line 87 of file vec.h.

References cgv::math::vec< T >::_data, cgv::math::vec< T >::_size, cgv::math::vec< T >::data_is_external, and cgv::math::vec< T >::size().

◆ vec() [5/8]

template<typename T >
template<typename S >
cgv::math::vec< T >::vec ( const vec< S > &  v)
inline

copy constructor for vectors with different element type

Definition at line 99 of file vec.h.

References cgv::math::vec< T >::_data, cgv::math::vec< T >::_size, cgv::math::vec< T >::data_is_external, and cgv::math::vec< T >::size().

◆ vec() [6/8]

template<typename T >
cgv::math::vec< T >::vec ( const T &  c0,
const T &  c1 
)
inline

creates a 2d vector (c0,c1)^T

Definition at line 111 of file vec.h.

References cgv::math::vec< T >::_data, cgv::math::vec< T >::_size, and cgv::math::vec< T >::data_is_external.

◆ vec() [7/8]

template<typename T >
cgv::math::vec< T >::vec ( const T &  c0,
const T &  c1,
const T &  c2 
)
inline

creates a 3d vector (c0,c1,c2)^T

Definition at line 119 of file vec.h.

References cgv::math::vec< T >::_data, cgv::math::vec< T >::_size, and cgv::math::vec< T >::data_is_external.

◆ vec() [8/8]

template<typename T >
cgv::math::vec< T >::vec ( const T &  c0,
const T &  c1,
const T &  c2,
const T &  c3 
)
inline

creates a 4d vector (c0,c1,c2,c3)^T

Definition at line 130 of file vec.h.

References cgv::math::vec< T >::_data, cgv::math::vec< T >::_size, and cgv::math::vec< T >::data_is_external.

◆ ~vec()

template<typename T >
virtual cgv::math::vec< T >::~vec ( )
inlinevirtual

destructor

Definition at line 176 of file vec.h.

Member Function Documentation

◆ abs()

template<typename T >
void cgv::math::vec< T >::abs ( )
inline

componentwise absolute values

Definition at line 547 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ begin() [1/2]

template<typename T >
iterator cgv::math::vec< T >::begin ( )
inline

Definition at line 50 of file vec.h.

◆ begin() [2/2]

template<typename T >
const_iterator cgv::math::vec< T >::begin ( ) const
inline

Definition at line 52 of file vec.h.

◆ ceil()

template<typename T >
void cgv::math::vec< T >::ceil ( )
inline

ceil componentwise

Definition at line 557 of file vec.h.

References cgv::math::vec< T >::_data, cgv::math::vec< T >::_size, and cgv::math::vec< T >::ceil().

Referenced by cgv::math::vec< T >::ceil().

◆ copy()

template<typename T >
void cgv::math::vec< T >::copy ( unsigned  ifrom,
unsigned  s,
vec< T > &  subvec 
) const
inline

copy sub vector beginning at index ifrom with given size s into subvec

Definition at line 619 of file vec.h.

References cgv::math::vec< T >::operator()(), and cgv::math::vec< T >::size().

◆ data() [1/2]

template<typename T >
T * cgv::math::vec< T >::data ( )
inline

◆ data() [2/2]

template<typename T >
const T * cgv::math::vec< T >::data ( ) const
inline

cast into const array

Definition at line 198 of file vec.h.

References cgv::math::vec< T >::_data.

◆ destruct()

template<typename T >
void cgv::math::vec< T >::destruct ( )
inline

Definition at line 181 of file vec.h.

◆ dim()

◆ end() [1/2]

template<typename T >
iterator cgv::math::vec< T >::end ( )
inline

Definition at line 51 of file vec.h.

◆ end() [2/2]

template<typename T >
const_iterator cgv::math::vec< T >::end ( ) const
inline

Definition at line 53 of file vec.h.

◆ fill()

template<typename T >
void cgv::math::vec< T >::fill ( const T &  v)
inline

◆ first() [1/2]

template<typename T >
T & cgv::math::vec< T >::first ( )
inline

element accessor for the first element

Definition at line 255 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

Referenced by cgv::math::qem< T >::scalar_part(), and cgv::math::qem< T >::set().

◆ first() [2/2]

template<typename T >
const T & cgv::math::vec< T >::first ( ) const
inline

const element accessor for the first element

Definition at line 262 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ floor()

template<typename T >
void cgv::math::vec< T >::floor ( )
inline

◆ last() [1/2]

template<typename T >
T & cgv::math::vec< T >::last ( )
inline

element accessor for the flast element

Definition at line 268 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ last() [2/2]

template<typename T >
const T & cgv::math::vec< T >::last ( ) const
inline

const element accessor for the last element

Definition at line 274 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ length()

template<typename T >
T cgv::math::vec< T >::length ( ) const
inline

length of the vector L2-Norm

Definition at line 541 of file vec.h.

References cgv::math::vec< T >::sqr_length().

Referenced by cgv::math::vec< T >::normalize(), and cgv::math::vec< T >::safe_normalize().

◆ normalize()

template<typename T >
void cgv::math::vec< T >::normalize ( )
inline

◆ ones() [1/2]

template<typename T >
void cgv::math::vec< T >::ones ( )
inline

fill the vector with ones

Definition at line 476 of file vec.h.

References cgv::math::vec< T >::fill().

◆ ones() [2/2]

template<typename T >
void cgv::math::vec< T >::ones ( unsigned  n)
inline

resize the vector to size n and fills thevector with ones

Definition at line 489 of file vec.h.

References cgv::math::vec< T >::fill(), and cgv::math::vec< T >::resize().

◆ operator!=()

template<typename T >
template<typename S >
bool cgv::math::vec< T >::operator!= ( const vec< S > &  v) const
inline

test for inequality

Definition at line 533 of file vec.h.

References cgv::math::vec< T >::_size.

◆ operator()() [1/2]

template<typename T >
T & cgv::math::vec< T >::operator() ( unsigned  i)
inline

element accessor

Definition at line 233 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

Referenced by cgv::math::vec< T >::copy(), and cgv::math::vec< T >::sub_vec().

◆ operator()() [2/2]

template<typename T >
const T & cgv::math::vec< T >::operator() ( unsigned  i) const
inline

const element accessor

Definition at line 240 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ operator*() [1/2]

template<typename T >
vec< T > cgv::math::vec< T >::operator* ( const T &  s) const
inline

multiplication with scalar s

Definition at line 447 of file vec.h.

◆ operator*() [2/2]

template<typename T >
template<typename S >
const vec< T > cgv::math::vec< T >::operator* ( const vec< S > &  v) const
inline

componentwise vector multiplication

Definition at line 423 of file vec.h.

◆ operator*=() [1/2]

template<typename T >
vec< T > & cgv::math::vec< T >::operator*= ( const T &  s)
inline

in place multiplication with s

Definition at line 352 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ operator*=() [2/2]

template<typename T >
template<typename S >
vec< T > & cgv::math::vec< T >::operator*= ( const vec< S > &  v)
inline

in place componentwise vector multiplication

Definition at line 381 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ operator+() [1/2]

template<typename T >
const vec< T > cgv::math::vec< T >::operator+ ( const T &  s) const
inline

componentwise addition of scalar

Definition at line 403 of file vec.h.

◆ operator+() [2/2]

template<typename T >
template<typename S >
const vec< T > cgv::math::vec< T >::operator+ ( const vec< S > &  v) const
inline

vector addition

Definition at line 397 of file vec.h.

◆ operator+=() [1/2]

template<typename T >
vec< T > & cgv::math::vec< T >::operator+= ( const T &  s)
inline

in place addition of a scalar s

Definition at line 336 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ operator+=() [2/2]

template<typename T >
template<typename S >
vec< T > & cgv::math::vec< T >::operator+= ( const vec< S > &  v)
inline

in place vector addition

Definition at line 365 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ operator-() [1/3]

template<typename T >
const vec< T > cgv::math::vec< T >::operator- ( const T &  s) const
inline

componentwise subtraction of scalar

Definition at line 409 of file vec.h.

◆ operator-() [2/3]

template<typename T >
template<typename S >
vec< T > cgv::math::vec< T >::operator- ( const vec< S > &  v) const
inline

vector subtraction

Definition at line 416 of file vec.h.

◆ operator-() [3/3]

template<typename T >
vec< T > cgv::math::vec< T >::operator- ( void  ) const
inline

negates the vector

Definition at line 439 of file vec.h.

◆ operator-=() [1/2]

template<typename T >
vec< T > & cgv::math::vec< T >::operator-= ( const T &  s)
inline

in place subtraction by scalar s

Definition at line 344 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ operator-=() [2/2]

template<typename T >
template<typename S >
vec< T > & cgv::math::vec< T >::operator-= ( const vec< S > &  v)
inline

in place vector subtraction

Definition at line 373 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ operator/() [1/2]

template<typename T >
vec< T > cgv::math::vec< T >::operator/ ( const T &  s) const
inline

divides vector by scalar s

Definition at line 454 of file vec.h.

◆ operator/() [2/2]

template<typename T >
template<typename S >
const vec< T > cgv::math::vec< T >::operator/ ( const vec< S > &  v) const
inline

componentwise vector division

Definition at line 431 of file vec.h.

◆ operator/=() [1/2]

template<typename T >
vec< T > & cgv::math::vec< T >::operator/= ( const T &  s)
inline

in place division by scalar s

Definition at line 358 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ operator/=() [2/2]

template<typename T >
template<typename S >
vec< T > & cgv::math::vec< T >::operator/= ( const vec< S > &  v)
inline

in place componentwise vector division

Definition at line 389 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ operator=() [1/3]

template<typename T >
vec< T > & cgv::math::vec< T >::operator= ( const T &  s)
inline

assignment of a scalar s

Definition at line 217 of file vec.h.

References cgv::math::vec< T >::fill().

◆ operator=() [2/3]

template<typename T >
template<typename S >
vec< T > & cgv::math::vec< T >::operator= ( const vec< S > &  v)
inline

assignment of a vector v

Definition at line 225 of file vec.h.

References cgv::math::vec< T >::_data, cgv::math::vec< T >::_size, cgv::math::vec< T >::resize(), and cgv::math::vec< T >::size().

◆ operator=() [3/3]

template<typename T >
vec< T > & cgv::math::vec< T >::operator= ( const vec< T > &  v)
inline

assignment of a vector v

Definition at line 204 of file vec.h.

References cgv::math::vec< T >::_data, cgv::math::vec< T >::_size, cgv::math::vec< T >::resize(), and cgv::math::vec< T >::size().

◆ operator==()

template<typename T >
template<typename S >
bool cgv::math::vec< T >::operator== ( const vec< S > &  v) const
inline

test for equality

Definition at line 524 of file vec.h.

References cgv::math::vec< T >::_size.

◆ operator[]() [1/2]

template<typename T >
T & cgv::math::vec< T >::operator[] ( unsigned  i)
inline

element accessor

Definition at line 245 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ operator[]() [2/2]

template<typename T >
const T & cgv::math::vec< T >::operator[] ( unsigned  i) const
inline

const element accessor

Definition at line 250 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ paste()

template<typename T >
void cgv::math::vec< T >::paste ( unsigned  ifrom,
const vec< T > &  v 
)
inline

paste v into vector beginning at index pos ifrom

Definition at line 629 of file vec.h.

References cgv::math::vec< T >::size().

◆ rbegin() [1/2]

template<typename T >
reverse_iterator cgv::math::vec< T >::rbegin ( )
inline

Definition at line 54 of file vec.h.

◆ rbegin() [2/2]

template<typename T >
const_reverse_iterator cgv::math::vec< T >::rbegin ( ) const
inline

Definition at line 56 of file vec.h.

◆ rend() [1/2]

template<typename T >
reverse_iterator cgv::math::vec< T >::rend ( )
inline

Definition at line 55 of file vec.h.

◆ rend() [2/2]

template<typename T >
const_reverse_iterator cgv::math::vec< T >::rend ( ) const
inline

Definition at line 57 of file vec.h.

◆ resize()

◆ round()

template<typename T >
void cgv::math::vec< T >::round ( )
inline

round componentwise

Definition at line 571 of file vec.h.

References cgv::math::vec< T >::_data, cgv::math::vec< T >::_size, and cgv::math::vec< T >::floor().

◆ safe_normalize()

template<typename T >
void cgv::math::vec< T >::safe_normalize ( )
inline

normalize the vector if length is not zero using the L2-Norm

Definition at line 596 of file vec.h.

References cgv::math::vec< T >::_size, and cgv::math::vec< T >::length().

◆ set() [1/3]

template<typename T >
void cgv::math::vec< T >::set ( const T &  c0,
const T &  c1 
)
inline

set entries of a 2d vector

Definition at line 142 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ set() [2/3]

template<typename T >
void cgv::math::vec< T >::set ( const T &  c0,
const T &  c1,
const T &  c2 
)
inline

set entries of a 3d vector

Definition at line 150 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ set() [3/3]

template<typename T >
void cgv::math::vec< T >::set ( const T &  c0,
const T &  c1,
const T &  c2,
const T &  c3 
)
inline

set entries of a 4d vector

Definition at line 159 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ set_extern_data()

template<typename T >
void cgv::math::vec< T >::set_extern_data ( unsigned  dim,
T *  data 
)
inline

◆ size()

template<typename T >
unsigned cgv::math::vec< T >::size ( ) const
inline

number of elements

Definition at line 59 of file vec.h.

References cgv::math::vec< T >::_size.

Referenced by cgv::media::axis_aligned_box< T, N >::add_point(), cgv::media::axis_aligned_box< T, N >::axis_aligned_box(), cgv::media::mesh::dual_contouring< X, T >::compute_cell_vertex(), cgv::math::vec< T >::copy(), cgv::math::qem< T >::dim(), cgv::math::mfunc< X, T >::evaluate_gradient(), cgv::media::plane< T >::get_distance(), cgv::media::plane< T >::get_normal(), cgv::render::array_descriptor_traits< cgv::math::vec< T > >::get_nr_elements(), cgv::render::array_descriptor_traits< cgv::math::vec< T > >::get_size(), cgv::math::perm_mat::identity(), cgv::math::thin_plate_spline< T >::map_position(), cgv::math::thin_hyper_plate_spline< T >::map_position(), cgv::math::qem< T >::minarg(), cgv::math::perm_mat::ncols(), cgv::render::gl::gl_implicit_surface_drawable_base::new_vertex(), cgv::math::perm_mat::nrows(), cgv::math::qem< T >::operator!=(), cgv::math::mat< T >::operator*(), cgv::math::sparse_mat< T >::operator*(), cgv::math::qem< T >::operator+=(), cgv::math::qem< T >::operator-=(), cgv::math::vec< T >::operator=(), cgv::math::vec< T >::operator=(), cgv::math::qem< T >::operator==(), cgv::math::vec< T >::paste(), cgv::media::plane< T >::plane(), cgv::render::context::put_cursor_coords(), cgv::math::qem< T >::set(), cgv::plot::plot_base::set_extent(), cgv::math::perm_mat::size(), cgv::media::sphere< T, N >::sphere(), cgv::math::vec< T >::sub_vec(), cgv::plot::plot_base::transform_to_world(), cgv::math::perm_mat::transpose(), cgv::math::sparse_mat< T >::transpose(), cgv::math::random::uniform(), cgv::math::random::uniform(), cgv::math::random::uniform(), cgv::math::random::uniform(), cgv::math::random::uniform_direction(), cgv::math::random::uniform_direction(), cgv::math::random::uniform_point_in_box(), cgv::math::random::uniform_point_in_unit_ball(), cgv::math::random::uniform_point_in_unit_box(), cgv::math::random::uniform_point_on_sphere(), cgv::math::vec< T >::vec(), cgv::math::vec< T >::vec(), and cgv::math::qem< T >::vector_part().

◆ sqr_length()

template<typename T >
T cgv::math::vec< T >::sqr_length ( ) const
inline

square length of vector

Definition at line 579 of file vec.h.

References cgv::math::vec< T >::_size.

Referenced by cgv::math::vec< T >::length(), and cgv::math::qem< T >::minarg().

◆ sub_vec()

template<typename T >
vec< T > cgv::math::vec< T >::sub_vec ( unsigned  ifrom,
unsigned  size 
) const
inline

extracts sub vector beginning at index ifrom with given size

Definition at line 607 of file vec.h.

References cgv::math::vec< T >::operator()(), and cgv::math::vec< T >::size().

◆ w() [1/2]

template<typename T >
T & cgv::math::vec< T >::w ( )
inline

element accessor for the fourth element

Definition at line 322 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ w() [2/2]

template<typename T >
const T & cgv::math::vec< T >::w ( ) const
inline

const element accessor for the fourth element

Definition at line 329 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ x() [1/2]

template<typename T >
T & cgv::math::vec< T >::x ( )
inline

element accessor for the first element

Definition at line 280 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ x() [2/2]

template<typename T >
const T & cgv::math::vec< T >::x ( ) const
inline

const element accessor for the first element

Definition at line 287 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ y() [1/2]

template<typename T >
T & cgv::math::vec< T >::y ( )
inline

element accessor for the second element

Definition at line 294 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

Referenced by cgv::math::qem< T >::minarg().

◆ y() [2/2]

template<typename T >
const T & cgv::math::vec< T >::y ( ) const
inline

const element accessor for the second element

Definition at line 301 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ z() [1/2]

template<typename T >
T & cgv::math::vec< T >::z ( )
inline

element accessor for the third element

Definition at line 308 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ z() [2/2]

template<typename T >
const T & cgv::math::vec< T >::z ( ) const
inline

const element accessor for the third element

Definition at line 315 of file vec.h.

References cgv::math::vec< T >::_data, and cgv::math::vec< T >::_size.

◆ zeros() [1/2]

◆ zeros() [2/2]

template<typename T >
void cgv::math::vec< T >::zeros ( unsigned  n)
inline

resize the vector to size n and fills the vector with zeros

Definition at line 482 of file vec.h.

References cgv::math::vec< T >::fill(), and cgv::math::vec< T >::resize().

Member Data Documentation

◆ _data

template<typename T >
T* cgv::math::vec< T >::_data
protected

◆ _size

template<typename T >
unsigned cgv::math::vec< T >::_size
protected

number or elements

Definition at line 34 of file vec.h.

Referenced by cgv::math::vec< T >::abs(), cgv::math::vec< T >::ceil(), cgv::math::vec< T >::dim(), cgv::math::vec< T >::fill(), cgv::math::vec< T >::first(), cgv::math::vec< T >::first(), cgv::math::vec< T >::floor(), cgv::math::vec< T >::last(), cgv::math::vec< T >::last(), cgv::math::vec< T >::normalize(), cgv::math::vec< T >::operator!=(), cgv::math::vec< T >::operator()(), cgv::math::vec< T >::operator()(), cgv::math::vec< T >::operator*=(), cgv::math::vec< T >::operator*=(), cgv::math::vec< T >::operator+=(), cgv::math::vec< T >::operator+=(), cgv::math::vec< T >::operator-=(), cgv::math::vec< T >::operator-=(), cgv::math::vec< T >::operator/=(), cgv::math::vec< T >::operator/=(), cgv::math::vec< T >::operator=(), cgv::math::vec< T >::operator=(), cgv::math::vec< T >::operator==(), cgv::math::vec< T >::operator[](), cgv::math::vec< T >::operator[](), cgv::math::vec< T >::resize(), cgv::math::vec< T >::round(), cgv::math::vec< T >::safe_normalize(), cgv::math::vec< T >::set(), cgv::math::vec< T >::set(), cgv::math::vec< T >::set(), cgv::math::vec< T >::set_extern_data(), cgv::math::vec< T >::size(), cgv::math::vec< T >::sqr_length(), cgv::math::vec< T >::vec(), cgv::math::vec< T >::vec(), cgv::math::vec< T >::vec(), cgv::math::vec< T >::vec(), cgv::math::vec< T >::vec(), cgv::math::vec< T >::vec(), cgv::math::vec< T >::vec(), cgv::math::vec< T >::w(), cgv::math::vec< T >::w(), cgv::math::vec< T >::x(), cgv::math::vec< T >::x(), cgv::math::vec< T >::y(), cgv::math::vec< T >::y(), cgv::math::vec< T >::z(), and cgv::math::vec< T >::z().

◆ data_is_external


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