cgv
cgv::math::qem< T > Class Template Reference

dimension independent implementation of quadric error metrics More...

#include <qem.h>

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

Public Member Functions

 qem (int d=-1)
 standard constructor initializes qem based on dimension
 
 qem (const vec< T > &p, const vec< T > &n)
 construct from point and normal
 
 qem (const vec< T > &n, T d)
 construct from normal and distance to origin
 
void set (const vec< T > &n, T d)
 set from normal and distance to origin
 
unsigned dim () const
 number of elements
 
qem< T > & operator= (const qem< T > &v)
 assignment of a vector v
 
const T & scalar_part () const
 return the scalar part of the qem
 
vec< T > vector_part () const
 return the vector part of the qem
 
mat< T > matrix_part () const
 return matrix part
 
evaluate (const vec< T > &p) const
 evaluate the quadric error metric at given location
 
vec< T > minarg (const vec< T > &p_ref, T relative_epsilon, T max_distance=-1, T epsilon=1e-10) const
 
template<typename S >
qem< T > & operator+= (const qem< S > &v)
 in place qem addition
 
template<typename S >
qem< T > & operator-= (const qem< S > &v)
 in place qem subtraction
 
template<typename S >
const qem< T > operator+ (const qem< S > &v) const
 qem addition
 
template<typename S >
qem< T > operator- (const qem< S > &v) const
 qem subtraction
 
qem< T > operator- (void) const
 negates the qem
 
qem< T > operator* (const T &s) const
 multiplication with scalar s
 
qem< T > operator/ (const T &s) const
 divides vector by scalar s
 
void resize (unsigned d)
 resize the vector
 
template<typename S >
bool operator== (const qem< S > &v) const
 test for equality
 
template<typename S >
bool operator!= (const qem< S > &v) const
 test for inequality
 
unsigned size () const
 number of elements
 
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
 
 operator T* ()
 cast into non const array
 
 operator const T * () const
 cast into const array
 
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
 
template<typename S >
vec< T > & operator+= (const vec< S > &v)
 in place vector addition
 
vec< T > & operator-= (const T &s)
 in place subtraction by scalar s
 
template<typename S >
vec< T > & operator-= (const vec< S > &v)
 in place vector subtraction
 
vec< T > & operator*= (const T &s)
 in place multiplication with s
 
template<typename S >
vec< T > & operator*= (const vec< S > &v)
 in place componentwise vector multiplication
 
vec< T > & operator/= (const T &s)
 in place division by scalar s
 
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
 
void fill (const T &v)
 fill elements of vector with scalar v
 
void zeros ()
 fill the vector with zeros
 
void zeros (unsigned n)
 resize the vector to size n and fills the vector with zeros
 
void ones ()
 fill the vector with ones
 
void ones (unsigned n)
 resize the vector to size n and fills thevector with ones
 
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
 
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::qem< T >

dimension independent implementation of quadric error metrics

Member Function Documentation

◆ minarg()

template<typename T >
vec<T> cgv::math::qem< T >::minarg ( const vec< T > &  p_ref,
relative_epsilon,
max_distance = -1,
epsilon = 1e-10 
) const
inline

compute point that minimizes distance to qem and is inside the sphere of radius max_distance around p_ref. If max_distance is -1, no sphere inclusion test is performed. relative_epsilon gives the absolute value of the fraction betweenan eigenvalue and the largest eigenvalue before it is set to zero. epsilon is a global limit on the absolute value of a singular value before accepted as non zero.


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