Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Related Functions | List of all members
vgl_quadric_3d< T > Class Template Reference

#include <vgl_quadric_3d.h>

Public Types

enum  vgl_quadric_type {
  no_type =0, real_ellipsoid, imaginary_ellipsoid, hyperboloid_of_one_sheet,
  hyperboloid_of_two_sheets, real_elliptic_cone, imaginary_elliptic_cone, elliptic_paraboloid,
  hyperbolic_paraboloid, real_elliptic_cylinder, imaginary_elliptic_cylinder, hyperbolic_cylinder,
  real_intersecting_planes, imaginary_intersecting_planes, parabolic_cylinder, real_parallel_planes,
  imaginary_parallel_planes, coincident_planes, num_quadric_types
}
 

Public Member Functions

vgl_quadric_type type () const
 
a () const
 Returns the coefficient of $X^2$. More...
 
b () const
 Returns the coefficient of $Y^2$. More...
 
c () const
 Returns the coefficient of $Z^2$. More...
 
d () const
 Returns the coefficient of $XY$. More...
 
e () const
 Returns the coefficient of $XZ$. More...
 
f () const
 Returns the coefficient of $YZ$. More...
 
g () const
 Returns the coefficient of $XW$. More...
 
h () const
 Returns the coefficient of $YW$. More...
 
i () const
 Returns the coefficient of $ZW$. More...
 
j () const
 Returns the coefficient of $W^2$. More...
 
 vgl_quadric_3d ()
 
 vgl_quadric_3d (T a, T b, T c, T d, T e, T f, T g, T h, T i, T j)
 constructor using polynomial coefficients. More...
 
 vgl_quadric_3d (T const coeff[])
 constructor from a linear array of polynomial coefficients, given as a C array. More...
 
 vgl_quadric_3d (std::vector< std::vector< T > > const &Q)
 constructor from a matix of polynomial coefficients (see below). More...
 
std::vector< std::vector< T > > coef_matrix () const
 return a matrix of quadric coefficients of the form:. More...
 
 vgl_quadric_3d (std::vector< std::vector< T > > const &canonical_quadric, std::vector< std::vector< T > > const &H)
 constructor from a canonical 4x4 quadric coefficient matrix and a 4x4 homogeneous matrix, H. More...
 
 vgl_quadric_3d (std::vector< T > const &diag, std::vector< std::vector< T > > const &H)
 constructor for central quadrics e.g. ellipsoid, ax^2+ by^2+ cz*2 + j = 0, where diag = [a,b,c,j]. More...
 
void set (T a, T b, T c, T d, T e, T f, T g, T h, T i, T j)
 set or reset the quadric using polynomial coefficients. More...
 
void set (std::vector< std::vector< T > > const &Q)
 
bool operator== (vgl_quadric_3d< T > const &c) const
 comparison operator. More...
 
bool is_degenerate () const
 Returns true if this quadric is degenerate. More...
 
sampson_dist (vgl_homg_point_3d< T > const &pt) const
 Sampson distance d_sampson(p) = ||p^t Q p||^2/||grad(p*t Q p)||^2. More...
 
bool on (vgl_homg_point_3d< T > const &pt, T tol=T(0)) const
 Returns true if the point pt belongs to the quadric surface. More...
 
bool center (vgl_point_3d< T > &center) const
 if the upper 3x3 submatrix of Q is full rank then the center of the quadric can be defined. More...
 
void upper_3x3_eigensystem (std::vector< T > &eigenvalues, std::vector< std::vector< T > > &eigenvectors) const
 : eigenvalues and eigenvectors of the upper 3x3 quadric matrix. More...
 
bool canonical_central_quadric (std::vector< T > &diag, std::vector< std::vector< T > > &H) const
 : The quadric in its canonical frame if the center is defined, i.e. the upper 3x3 quadric matrix is full rank. More...
 
std::vector< std::vector< T > > canonical_quadric (std::vector< std::vector< T > > &H) const
 The quadric coefficient matrix in the canonical frame, whether or not the quadric is central. More...
 

Static Public Member Functions

static vgl_quadric_type type_by_name (std::string const &name)
 Returns the internal enum value corresponding to the string argument. More...
 
static std::string type_by_number (vgl_quadric_type const &type)
 Converts the quadric type from enum (internal representation) to string. More...
 

Private Member Functions

void compute_type ()
 set quadric type from polynomial coefficients and store in member type_. More...
 

Private Attributes

bool det_zero_
 
vgl_quadric_type type_
 
a_
 coefficient of x^2 More...
 
b_
 coefficient of y^2 More...
 
c_
 coefficient of z^2 More...
 
d_
 coefficient of xy More...
 
e_
 coefficient of xz More...
 
f_
 coefficient of yz More...
 
g_
 coefficient of xw More...
 
h_
 coefficient of yw More...
 
i_
 coefficient of zw More...
 
j_
 coefficient of w^2 More...
 

Related Functions

(Note that these are not member functions.)

template<class T >
std::istream & operator>> (std::istream &s, vgl_quadric_3d< T > &c)
 Read a b c d e f g h i j from stream. More...
 

Detailed Description

template<class T>
class vgl_quadric_3d< T >

Definition at line 32 of file vgl_quadric_3d.h.

Member Enumeration Documentation

◆ vgl_quadric_type

template<class T>
enum vgl_quadric_3d::vgl_quadric_type
Enumerator
no_type 
real_ellipsoid 
imaginary_ellipsoid 
hyperboloid_of_one_sheet 
hyperboloid_of_two_sheets 
real_elliptic_cone 
imaginary_elliptic_cone 
elliptic_paraboloid 
hyperbolic_paraboloid 
real_elliptic_cylinder 
imaginary_elliptic_cylinder 
hyperbolic_cylinder 
real_intersecting_planes 
imaginary_intersecting_planes 
parabolic_cylinder 
real_parallel_planes 
imaginary_parallel_planes 
coincident_planes 
num_quadric_types 

Definition at line 35 of file vgl_quadric_3d.h.

Constructor & Destructor Documentation

◆ vgl_quadric_3d() [1/6]

template<class T>
vgl_quadric_3d< T >::vgl_quadric_3d ( )
inline

Definition at line 114 of file vgl_quadric_3d.h.

◆ vgl_quadric_3d() [2/6]

template<class T >
vgl_quadric_3d< T >::vgl_quadric_3d ( a,
b,
c,
d,
e,
f,
g,
h,
i,
j 
)

constructor using polynomial coefficients.

Definition at line 45 of file vgl_quadric_3d.hxx.

◆ vgl_quadric_3d() [3/6]

template<class T >
vgl_quadric_3d< T >::vgl_quadric_3d ( T const  coeff[])

constructor from a linear array of polynomial coefficients, given as a C array.

Definition at line 49 of file vgl_quadric_3d.hxx.

◆ vgl_quadric_3d() [4/6]

template<class T >
vgl_quadric_3d< T >::vgl_quadric_3d ( std::vector< std::vector< T > > const &  Q)

constructor from a matix of polynomial coefficients (see below).

Definition at line 60 of file vgl_quadric_3d.hxx.

◆ vgl_quadric_3d() [5/6]

template<class T >
vgl_quadric_3d< T >::vgl_quadric_3d ( std::vector< std::vector< T > > const &  canonical_quadric,
std::vector< std::vector< T > > const &  H 
)

constructor from a canonical 4x4 quadric coefficient matrix and a 4x4 homogeneous matrix, H.

representing the Euclidean transformation from the canonical frame to the global frame _ _ |R t| where t is a 3x1 translation vector and R is a rotation matrix H = | | 0^t is a 1x3 zero vector. |0^t 1|

  • -

Definition at line 65 of file vgl_quadric_3d.hxx.

◆ vgl_quadric_3d() [6/6]

template<class T >
vgl_quadric_3d< T >::vgl_quadric_3d ( std::vector< T > const &  diag,
std::vector< std::vector< T > > const &  H 
)

constructor for central quadrics e.g. ellipsoid, ax^2+ by^2+ cz*2 + j = 0, where diag = [a,b,c,j].

are the diagonal elements of the 4x4 quadric coefficient matrix and a 4x4 homogeneous matrix, and H represents the Euclidean transformation from the canonical frame to the global frame (see above)

Definition at line 120 of file vgl_quadric_3d.hxx.

Member Function Documentation

◆ a()

template<class T>
T vgl_quadric_3d< T >::a ( ) const
inline

Returns the coefficient of $X^2$.

Definition at line 83 of file vgl_quadric_3d.h.

◆ b()

template<class T>
T vgl_quadric_3d< T >::b ( ) const
inline

Returns the coefficient of $Y^2$.

Definition at line 86 of file vgl_quadric_3d.h.

◆ c()

template<class T>
T vgl_quadric_3d< T >::c ( ) const
inline

Returns the coefficient of $Z^2$.

Definition at line 89 of file vgl_quadric_3d.h.

◆ canonical_central_quadric()

template<class T >
bool vgl_quadric_3d< T >::canonical_central_quadric ( std::vector< T > &  diag,
std::vector< std::vector< T > > &  H 
) const

: The quadric in its canonical frame if the center is defined, i.e. the upper 3x3 quadric matrix is full rank.

In this case the quadric coefficient matrix in the canonical frame is a 4x4 diagonal matrix, e.g. ax^2 + by^2 + cz^2 + j = 0. Note that the canonical frame is not unique as alignment of quadric axes with the orthogonal frame has numerous possible arrangements. H is a homogenous(4x4)transformation from canonical coordinate space back to the original space.

Definition at line 398 of file vgl_quadric_3d.hxx.

◆ canonical_quadric()

template<class T >
std::vector< std::vector< T > > vgl_quadric_3d< T >::canonical_quadric ( std::vector< std::vector< T > > &  H) const

The quadric coefficient matrix in the canonical frame, whether or not the quadric is central.

H is a homogenous(4x4)transformation from canonical coordinate space back to the original space.

Definition at line 424 of file vgl_quadric_3d.hxx.

◆ center()

template<class T >
bool vgl_quadric_3d< T >::center ( vgl_point_3d< T > &  center) const

if the upper 3x3 submatrix of Q is full rank then the center of the quadric can be defined.

otherwise the center is not defined for degenerate quadrics

Definition at line 166 of file vgl_quadric_3d.hxx.

◆ coef_matrix()

template<class T >
std::vector< std::vector< T > > vgl_quadric_3d< T >::coef_matrix ( ) const

return a matrix of quadric coefficients of the form:.

_ _ | a d/2 e/2 g/2 | | d/2 b f/2 h/2 | Q = | e/2 f/2 c i/2 | | g/2 h/2 i/2 j |

  • - Note that X^t Q X = 0 , where X^t =[x y z w] is the same as implicit equation 1) above.

Definition at line 139 of file vgl_quadric_3d.hxx.

◆ compute_type()

template<class T >
void vgl_quadric_3d< T >::compute_type ( )
private

set quadric type from polynomial coefficients and store in member type_.

Definition at line 205 of file vgl_quadric_3d.hxx.

◆ d()

template<class T>
T vgl_quadric_3d< T >::d ( ) const
inline

Returns the coefficient of $XY$.

Definition at line 92 of file vgl_quadric_3d.h.

◆ e()

template<class T>
T vgl_quadric_3d< T >::e ( ) const
inline

Returns the coefficient of $XZ$.

Definition at line 95 of file vgl_quadric_3d.h.

◆ f()

template<class T>
T vgl_quadric_3d< T >::f ( ) const
inline

Returns the coefficient of $YZ$.

Definition at line 98 of file vgl_quadric_3d.h.

◆ g()

template<class T>
T vgl_quadric_3d< T >::g ( ) const
inline

Returns the coefficient of $XW$.

Definition at line 101 of file vgl_quadric_3d.h.

◆ h()

template<class T>
T vgl_quadric_3d< T >::h ( ) const
inline

Returns the coefficient of $YW$.

Definition at line 104 of file vgl_quadric_3d.h.

◆ i()

template<class T>
T vgl_quadric_3d< T >::i ( ) const
inline

Returns the coefficient of $ZW$.

Definition at line 107 of file vgl_quadric_3d.h.

◆ is_degenerate()

template<class T>
bool vgl_quadric_3d< T >::is_degenerate ( ) const
inline

Returns true if this quadric is degenerate.

Definition at line 164 of file vgl_quadric_3d.h.

◆ j()

template<class T>
T vgl_quadric_3d< T >::j ( ) const
inline

Returns the coefficient of $W^2$.

Definition at line 110 of file vgl_quadric_3d.h.

◆ on()

template<class T >
bool vgl_quadric_3d< T >::on ( vgl_homg_point_3d< T > const &  pt,
tol = T(0) 
) const

Returns true if the point pt belongs to the quadric surface.

I.e., if it satisfies the quadric equation within algebraic distance, i.e. pt^t Q pt < tol;

Definition at line 159 of file vgl_quadric_3d.hxx.

◆ operator==()

template<class T >
bool vgl_quadric_3d< T >::operator== ( vgl_quadric_3d< T > const &  c) const

comparison operator.

Comparison is on the quadric, not the equation coefficients. Hence two quadrics are identical if their coefficient vectors are multiples of each other.

Definition at line 363 of file vgl_quadric_3d.hxx.

◆ sampson_dist()

template<class T >
T vgl_quadric_3d< T >::sampson_dist ( vgl_homg_point_3d< T > const &  pt) const

Sampson distance d_sampson(p) = ||p^t Q p||^2/||grad(p*t Q p)||^2.

a first order approximation to Euclidean distance

Definition at line 148 of file vgl_quadric_3d.hxx.

◆ set() [1/2]

template<class T >
void vgl_quadric_3d< T >::set ( a,
b,
c,
d,
e,
f,
g,
h,
i,
j 
)

set or reset the quadric using polynomial coefficients.

Definition at line 127 of file vgl_quadric_3d.hxx.

◆ set() [2/2]

template<class T >
void vgl_quadric_3d< T >::set ( std::vector< std::vector< T > > const &  Q)

Definition at line 133 of file vgl_quadric_3d.hxx.

◆ type()

template<class T>
vgl_quadric_type vgl_quadric_3d< T >::type ( ) const
inline

Definition at line 73 of file vgl_quadric_3d.h.

◆ type_by_name()

template<class T >
vgl_quadric_3d< T >::vgl_quadric_type vgl_quadric_3d< T >::type_by_name ( std::string const &  name)
static

Returns the internal enum value corresponding to the string argument.

Useful for comparison purposes, or for use in "case" statements.

Definition at line 36 of file vgl_quadric_3d.hxx.

◆ type_by_number()

template<class T >
std::string vgl_quadric_3d< T >::type_by_number ( vgl_quadric_type const &  type)
static

Converts the quadric type from enum (internal representation) to string.

Definition at line 33 of file vgl_quadric_3d.hxx.

◆ upper_3x3_eigensystem()

template<class T >
void vgl_quadric_3d< T >::upper_3x3_eigensystem ( std::vector< T > &  eigenvalues,
std::vector< std::vector< T > > &  eigenvectors 
) const

: eigenvalues and eigenvectors of the upper 3x3 quadric matrix.

Definition at line 381 of file vgl_quadric_3d.hxx.

Friends And Related Function Documentation

◆ operator>>()

template<class T >
std::istream & operator>> ( std::istream &  s,
vgl_quadric_3d< T > &  c 
)
related

Read a b c d e f g h i j from stream.

Member Data Documentation

◆ a_

template<class T>
T vgl_quadric_3d< T >::a_
private

coefficient of x^2

Definition at line 61 of file vgl_quadric_3d.h.

◆ b_

template<class T>
T vgl_quadric_3d< T >::b_
private

coefficient of y^2

Definition at line 62 of file vgl_quadric_3d.h.

◆ c_

template<class T>
T vgl_quadric_3d< T >::c_
private

coefficient of z^2

Definition at line 63 of file vgl_quadric_3d.h.

◆ d_

template<class T>
T vgl_quadric_3d< T >::d_
private

coefficient of xy

Definition at line 64 of file vgl_quadric_3d.h.

◆ det_zero_

template<class T>
bool vgl_quadric_3d< T >::det_zero_
private

Definition at line 59 of file vgl_quadric_3d.h.

◆ e_

template<class T>
T vgl_quadric_3d< T >::e_
private

coefficient of xz

Definition at line 65 of file vgl_quadric_3d.h.

◆ f_

template<class T>
T vgl_quadric_3d< T >::f_
private

coefficient of yz

Definition at line 66 of file vgl_quadric_3d.h.

◆ g_

template<class T>
T vgl_quadric_3d< T >::g_
private

coefficient of xw

Definition at line 67 of file vgl_quadric_3d.h.

◆ h_

template<class T>
T vgl_quadric_3d< T >::h_
private

coefficient of yw

Definition at line 68 of file vgl_quadric_3d.h.

◆ i_

template<class T>
T vgl_quadric_3d< T >::i_
private

coefficient of zw

Definition at line 69 of file vgl_quadric_3d.h.

◆ j_

template<class T>
T vgl_quadric_3d< T >::j_
private

coefficient of w^2

Definition at line 70 of file vgl_quadric_3d.h.

◆ type_

template<class T>
vgl_quadric_type vgl_quadric_3d< T >::type_
private

Definition at line 60 of file vgl_quadric_3d.h.


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