#include <geometry_quadric.h>
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_type > | quadric_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_type & | operator= (quadric_type const &q) |
quadric_type & | operator* (real_type const &s) |
quadric_type | operator+ (quadric_type const &q) |
void | set_sphere (real_type const &radius, vector3_type const ¢er) |
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 ¢er, 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 |
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
typedef OpenTissue::math::Matrix3x3<real_type> OpenTissue::geometry::Quadric< real_type_ >::matrix3x3_type |
typedef Quadric<real_type> OpenTissue::geometry::Quadric< real_type_ >::quadric_type |
typedef real_type_ OpenTissue::geometry::Quadric< real_type_ >::real_type |
typedef OpenTissue::math::Vector3<real_type> OpenTissue::geometry::Quadric< real_type_ >::vector3_type |
OpenTissue::geometry::Quadric< real_type_ >::Quadric | ( | ) | [inline] |
OpenTissue::geometry::Quadric< real_type_ >::Quadric | ( | matrix3x3_type const & | A, | |
vector3_type const & | B, | |||
real_type const & | C | |||
) | [inline] |
real_type OpenTissue::geometry::Quadric< real_type_ >::operator() | ( | vector3_type const & | x | ) | [inline] |
quadric_type& OpenTissue::geometry::Quadric< real_type_ >::operator* | ( | real_type const & | s | ) | [inline] |
quadric_type OpenTissue::geometry::Quadric< real_type_ >::operator+ | ( | quadric_type const & | q | ) | [inline] |
quadric_type& OpenTissue::geometry::Quadric< real_type_ >::operator= | ( | quadric_type const & | q | ) | [inline] |
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.
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. |
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] |
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.
void OpenTissue::geometry::Quadric< real_type_ >::set_sphere | ( | real_type const & | radius, | |
vector3_type const & | center | |||
) | [inline] |
matrix3x3_type OpenTissue::geometry::Quadric< real_type_ >::m_A |
vector3_type OpenTissue::geometry::Quadric< real_type_ >::m_B |
real_type OpenTissue::geometry::Quadric< real_type_ >::m_C |