Cgv::math::fvec< T, N > Class Template Reference

cgv
Public Member Functions | Static Public Member Functions | List of all members cgv::math::fvec< T, N > Class Template Reference

#include <fvec.h>

Public Member Functions

const_reverse_iterator rend () const
 reverse iterator pointing to the end of reverse iteration
 
 fvec ()
 creates a vector not initialized
 
 fvec (const T &a)
 creates a vector, where all N components are initialized to the constant value a
 
 fvec (const T &x, const T &y)
 construct and init first two coordinates to the given values
 
 fvec (const T &x, const T &y, const T &z)
 construct and init first three coordinates to the given values
 
 fvec (const T &x, const T &y, const T &z, const T &w)
 construct and init first four coordinates to the given values
 
 fvec (cgv::type::uint32_type n, const T *a)
 creates a vector from a n-element array a, if n < N remaining N-n elements are set to zero
 
template<typename S >
 fvec (cgv::type::uint32_type n, const S *a)
 creates a column vector initialized to array of a different type with zeros filled to not copied components
 
 fvec (const fvec< T, N > &rhs)
 copy constructor
 
template<typename S >
 fvec (const fvec< S, N > &fv)
 copies a column vector of a different type
 
template<typename S1 , typename S2 >
 fvec (const fvec< S1, N - 1 > &fv, S2 w)
 construct from vector of one dimension less plus a scalar
 
fvec & operator= (const fvec< T, N > &rhs)
 assign vector rhs, if vector and rhs have different sizes, vector has been resized to match the size of
 
fvec & operator= (const T &a)
 set all components of vector to constant value a
 
void set (const T &x, const T &y)
 set the first two components
 
void set (const T &x, const T &y, const T &z)
 set the first three components
 
void set (const T &x, const T &y, const T &z, const T &w)
 set the first four components
 
void fill (const T &a)
 fill elements of vector with scalar v
 
void zeros ()
 fill the vector with zeros
 
void ones ()
 fill the vector with ones
 
fvec< T, N+1 > lift () const
 convert to homogeneous version by adding a 1
 
vec< T > to_vec () const
 conversion to vector type
 
T & x ()
 first element
 
const T & x () const
 first element of const vector
 
T & y ()
 second element
 
const T & y () const
 second element of const vector
 
T & z ()
 third element
 
const T & z () const
 third element of const vector
 
T & w ()
 fourth element
 
const T & w () const
 fourth element of const vector
 
T & operator() (const int i)
 access i'th element
 
const T & operator() (const int i) const
 access i'th element of const vector
 
 operator T* ()
 cast into array. This allows calls like glVertex<N><T>v(p) instead of glVertex<N><T,N>(p.x(),p.y(),....)
 
 operator const T * () const
 cast into const array
 
fvec< T, N > & operator+= (const T &s)
 in place addition of a scalar s
 
fvec< T, N > & operator-= (const T &s)
 in place subtraction by scalar s
 
fvec< T, N > & operator*= (const T &s)
 in place multiplication with s
 
fvec< T, N > & operator/= (const T &s)
 in place division by scalar s
 
template<typename S >
fvec< T, N > & operator+= (const fvec< S, N > &_v)
 in place vector addition
 
template<typename S >
fvec< T, N > & operator-= (const fvec< S, N > &_v)
 in place vector subtraction
 
template<typename S >
fvec< T, N > & operator*= (const fvec< S, N > &_v)
 in place componentwise vector multiplication
 
template<typename S >
fvec< T, N > & operator/= (const fvec< S, N > &_v)
 in place componentwise vector division
 
template<typename S >
fvec< T, N > operator+ (const fvec< S, N > &v) const
 vector addition
 
fvec< T, N > operator+ (const T &s) const
 componentwise addition of scalar
 
fvec< T, N > operator- (const T &s) const
 componentwise subtraction of scalar
 
template<typename S >
fvec< T, N > operator- (const fvec< S, N > &v) const
 vector subtraction
 
template<typename S >
fvec< T, N > operator* (const fvec< S, N > &v) const
 componentwise vector multiplication
 
template<typename S >
fvec< T, N > operator/ (const fvec< S, N > &v) const
 componentwise vector division
 
fvec< T, N > operator- (void) const
 negates the vector
 
fvec< T, N > operator* (const T &s) const
 multiplication with scalar s
 
fvec< T, N > operator/ (const T &s) const
 divides vector by scalar s
 
template<typename S >
bool operator== (const fvec< S, N > &v) const
 test for equality
 
template<typename S >
bool operator!= (const fvec< S, N > &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
 
double normalize ()
 normalize the vector using the L2-Norm and return the length
 

Static Public Member Functions

static fvec< T, N > from_vec (const vec< T > &)
 conversion from vector
 
static cgv::type::uint32_type size ()
 return number of elements
 

Detailed Description

template<typename T, cgv::type::uint32_type N> class cgv::math::fvec< T, N >

A vector with zero based index.

The documentation for this class was generated from the following file:
  • D:/develop/projects/git/cgv/cgv/math/fvec.h
  • cgv
  • math
  • fvec
  • Generated by doxygen 1.8.18

Từ khóa » Cgv.n