Public Types | Public Member Functions | Public Attributes

OpenTissue::geometry::Quadric< real_type_ > Class Template Reference

#include <geometry_quadric.h>

List of all members.

Public Types

typedef real_type_ real_type
typedef
OpenTissue::math::Vector3
< real_type
vector3_type
typedef
OpenTissue::math::Matrix3x3
< real_type
matrix3x3_type
typedef Quadric< real_typequadric_type

Public Member Functions

 Quadric ()
 Quadric (matrix3x3_type const &A, vector3_type const &B, real_type const &C)
real_type operator() (vector3_type const &x)
quadric_typeoperator= (quadric_type const &q)
quadric_typeoperator* (real_type const &s)
quadric_type operator+ (quadric_type const &q)
void set_sphere (real_type const &radius, vector3_type const &center)
void set_plane_product (vector3_type const &p, vector3_type const &np, vector3_type const &q, vector3_type const &nq)
void set_cylinder (vector3_type const &center, vector3_type const &axis0, real_type const &radius0, vector3_type const &axis1, real_type const &radius1)

Public Attributes

matrix3x3_type m_A
vector3_type m_B
real_type m_C

Detailed Description

template<typename real_type_>
class OpenTissue::geometry::Quadric< real_type_ >

Internal auxiliary class.

For instance in homegeneous coordinates all points on the surface of an ellipsoid must fulfill the equation

| A B| |x| |x^T 1| | B^T C| |1| = 0

This is equivalent to the condition

x^T A2 x + 2 B2^T x + C2 = 0

The left-hand-side (LHS) is a quadratic function in x, this class helops representing the LHS of this equation.

Note that a non-symmetrical quadric can be made symmetrical by

| A E| |x| |x^T 1| | D^T C| |1| = 0 => x^T A x + x^T E + D^T x + C = x^T A x + (E + D)^T x + C = 0

Then define

B = (E + D)/2


Member Typedef Documentation

template<typename real_type_>
typedef OpenTissue::math::Matrix3x3<real_type> OpenTissue::geometry::Quadric< real_type_ >::matrix3x3_type
template<typename real_type_>
typedef Quadric<real_type> OpenTissue::geometry::Quadric< real_type_ >::quadric_type
template<typename real_type_>
typedef real_type_ OpenTissue::geometry::Quadric< real_type_ >::real_type
template<typename real_type_>
typedef OpenTissue::math::Vector3<real_type> OpenTissue::geometry::Quadric< real_type_ >::vector3_type

Constructor & Destructor Documentation

template<typename real_type_>
OpenTissue::geometry::Quadric< real_type_ >::Quadric (  )  [inline]
template<typename real_type_>
OpenTissue::geometry::Quadric< real_type_ >::Quadric ( matrix3x3_type const &  A,
vector3_type const &  B,
real_type const &  C 
) [inline]

Member Function Documentation

template<typename real_type_>
real_type OpenTissue::geometry::Quadric< real_type_ >::operator() ( vector3_type const &  x  )  [inline]
template<typename real_type_>
quadric_type& OpenTissue::geometry::Quadric< real_type_ >::operator* ( real_type const &  s  )  [inline]
template<typename real_type_>
quadric_type OpenTissue::geometry::Quadric< real_type_ >::operator+ ( quadric_type const &  q  )  [inline]
template<typename real_type_>
quadric_type& OpenTissue::geometry::Quadric< real_type_ >::operator= ( quadric_type const &  q  )  [inline]
template<typename real_type_>
void OpenTissue::geometry::Quadric< real_type_ >::set_cylinder ( vector3_type const &  center,
vector3_type const &  axis0,
real_type const &  radius0,
vector3_type const &  axis1,
real_type const &  radius1 
) [inline]

Defines a quadric that represent an elliptical cylinder tube. The argument defines a planar ellipsoid profile (cross-section) that sweeps out the cylindrical tube.

Parameters:
center The center of the ellipsoid
axis0 The first axis of the ellipsoid.
axis1 The secod axis of the ellipsoid (orthogonal to the first).
radius0 The radius of the first axis.
radius1 The radius of the second axis.
template<typename real_type_>
void OpenTissue::geometry::Quadric< real_type_ >::set_plane_product ( vector3_type const &  p,
vector3_type const &  np,
vector3_type const &  q,
vector3_type const &  nq 
) [inline]

Plane Product Quadric.

Defining:

(x - p)^T np * ( q - x)^T nq = 0

This means that x must lie either on plane (p,np) or (q,nq)... Note this is signed distance of one plane multiplied by the negative signed distance of the other plane.

Retwritting using homegeneous coordintes

| A2 B2| |x| |x^T 1| | B2^T C2| |1| = 0

Which is equivalent to

x^T A2 x + 2 B2^T x + C2 = 0

Straightforward computation then shows that

A2 = - np nq^T

| np0 nq*q + nq0 np*p | 2 B2 = | np1 nq*q + nq1 np*p | | np2 nq*q + nq2 np*p |

C2 = - p^T np * q^T nq

Observe that if the point x lies on opposite sides of the two planes then the sign is positive. On the other hand if x lies on the same side (front or back) of the two planes, then the sign is negative.

template<typename real_type_>
void OpenTissue::geometry::Quadric< real_type_ >::set_sphere ( real_type const &  radius,
vector3_type const &  center 
) [inline]

Set Quadric to a Sphere.

Parameters:
radius The radius of the sphere.
center The center of the sphere.

Member Data Documentation

template<typename real_type_>
matrix3x3_type OpenTissue::geometry::Quadric< real_type_ >::m_A
template<typename real_type_>
vector3_type OpenTissue::geometry::Quadric< real_type_ >::m_B
template<typename real_type_>
real_type OpenTissue::geometry::Quadric< real_type_ >::m_C

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