Public Types | Public Member Functions | Public Attributes | Static Public Attributes

OpenTissue::vclip::VClip Class Reference

#include <vclip.h>

List of all members.

Public Types

enum  result_type { PENETRATION, CONTINUE, DISJOINT }
typedef
vclip_mesh_type::vertex_halfedge_circulator 
vertex_halfedge_circulator
typedef
vclip_mesh_type::face_halfedge_circulator 
face_halfedge_circulator
typedef
vclip_mesh_type::face_iterator 
face_iterator
typedef
vclip_mesh_type::vertex_type 
vertex_type
typedef
vclip_mesh_type::halfedge_type 
halfedge_type
typedef vclip_mesh_type::face_type face_type
typedef vertex_typevertex_pointer
typedef halfedge_typehalfedge_pointer
typedef face_typeface_pointer
typedef Featurefeature_pointer
typedef halfedge_type::plane_type plane_type
typedef vclip_mesh_type::math_types math_types
typedef math_types::vector3_type vector3_type
typedef math_types::real_type real_type
typedef unsigned char state_type
typedef
OpenTissue::math::CoordSys
< real_type
coordsys_type

Public Member Functions

real_type run (vclip_mesh_type const &meshA, vclip_mesh_type const &meshB, coordsys_type const &AtoB, coordsys_type const &BtoA, feature_pointer *seedA, feature_pointer *seedB, vector3_type &cpA, vector3_type &cpB, unsigned int const max_iterations=500)

Public Attributes

feature_pointer m_vertexA
 Temporary Storage. All these are used to pass along information about the two current withness features to each state handler.
feature_pointer m_vertexB
feature_pointer m_vertex
feature_pointer m_edgeA
feature_pointer m_edgeB
feature_pointer m_edge
feature_pointer m_face
real_type m_distance
 The Separation Distance.
std::vector< int > m_code
std::vector< real_typem_parameter

Static Public Attributes

static const state_type vertex_vertex_state = 0
static const state_type vertex_edge_state = 1
static const state_type edge_vertex_state = 4
static const state_type vertex_face_state = 2
static const state_type face_vertex_state = 8
static const state_type edge_edge_state = 5
static const state_type edge_face_state = 6
static const state_type face_edge_state = 9
static const int INSIDE = 0x000
static const int OUTSIDE = 0x001
static const int MIN = 0x002
static const int MAX = 0x004

Detailed Description

Voronoi Clip Algorithm. One have to setup a vclip mesh in order to use this collision algorithm. An vclip mesh is a polygon mesh annotated with voronoi planes of the external voronoi regions of each mesh feature.

An utility tool have been created for setting up a vclip mesh. An example:

polymesh::PolyMesh<....> my_usual_mesh; mesh::obj_read(my_favorite_polymesh_file,my_usual_mesh); vclip_mesh_type my_vclip_mesh; convert(my_usual_mesh,my_vclip_mesh);

Now you can simply invoke the run method on this class to do a collision test between two vclip meshes.

Here is a little longer example. First at startup one initializes the geometries

OpenTissue::vclip::vclip_mesh_type A; OpenTissue::vclip::vclip_mesh_type B;

polymesh::PolyMesh<> tmp; mesh::make_box(1.0,1.0,1.0, tmp); mesh::make_box(1.0,1.0,1.0, tmp);

OpenTissue::vclip::convert(tmp,A); OpenTissue::vclip::convert(tmp,B);

Then during runtime, one determines where the geometries are places in the world

coordsys_type Awcs = coordsys_type( vector3_type(-1.0,0.0,0.0), quaternion_type()); coordsys_type Bwcs = coordsys_type( vector3_type( 1.0,0.0,0.0), quaternion_type()); coordsys_type AtoB = model_update(Awcs,Bwcs); coordsys_type BtoA = inverse(AtoB);

Finally one can query the vclip algorithm about cloest features and separation distance.

OpenTissue::vclip::Feature * seed_a = &( * ea ); OpenTissue::vclip::Feature * seed_b = &( * fb ); real_type distance = vclip.run(A,B,AtoB,BtoA,&seed_a,&seed_b,p_a,p_b,max_iterations);


Member Typedef Documentation

typedef halfedge_type::plane_type OpenTissue::vclip::VClip::plane_type
typedef unsigned char OpenTissue::vclip::VClip::state_type

Member Enumeration Documentation

Enumerator:
PENETRATION 
CONTINUE 
DISJOINT 

Member Function Documentation

real_type OpenTissue::vclip::VClip::run ( vclip_mesh_type const &  meshA,
vclip_mesh_type const &  meshB,
coordsys_type const &  AtoB,
coordsys_type const &  BtoA,
feature_pointer seedA,
feature_pointer seedB,
vector3_type cpA,
vector3_type cpB,
unsigned int const   max_iterations = 500 
) [inline]

Run V-Clip algorithm. When this method is invoked the v-clip algorithm is run on the two specified polyhedra.

Parameters:
meshA The mesh of object A (in model frame).
meshB The mesh of object B (in model frame).
AtoB A coordinate transform from model frame of object A to the model frame of object B.
BtoA The inverse coordinate transform of AtoB.
seedA A feature from the mesh of object A. This is used to seed the algorithm.
seedB A feature from the mesh of object B. This is used to seed the algorithm.
cpA Upon return this argument holds the closest point on A.
cpB Upon return this argument holds the closest point on B.
max_iterations This is an iterative algorithm, one can use this argument to either do single steps (usefull for visualizing the internal feature tracking) or simply guard against infinite loops.
Returns:
The separation distance if polyhedra are disjoint, if polyhedra are exactly touching the value is zero and in case of penetration the value is negative.

Member Data Documentation

const int OpenTissue::vclip::VClip::INSIDE = 0x000 [static]

Constants used to describe an edges relative position to a edge-face voronoi plane.

See also:
m_code

Edge Clip Code. When an edge is clipped against the edge-face voronoi planes along the boundary of a face then this data structure is used to keep track of the edges position relatively to each voronoi plane.

That is an edge can be either inside, outside, minimum-cross or maximum-cross of a voronoi plane.

The Separation Distance.

Edge Clipping Parameter Storage. This array is used in a similar way to the code-array except this time we store the actual value of the clipping parameter.

Temporary Storage. All these are used to pass along information about the two current withness features to each state handler.

const int OpenTissue::vclip::VClip::MAX = 0x004 [static]
const int OpenTissue::vclip::VClip::MIN = 0x002 [static]
const int OpenTissue::vclip::VClip::OUTSIDE = 0x001 [static]

State type constants.


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