Namespaces | |
namespace | continuous |
Classes | |
class | GeometryInterface |
Functions | |
template<typename aabb_tree_geometry , typename contact_point_container > | |
void | aabb_tree_against_itself (aabb_tree_geometry const &aabb_tree, contact_point_container &contacts) |
template<typename real_type , typename vector3_type , typename matrix3x3_type > | |
unsigned int | box_box (vector3_type p_a, matrix3x3_type R_a, vector3_type const &a, vector3_type p_b, matrix3x3_type R_b, vector3_type const &b, real_type const &envelope, vector3_type *p, vector3_type &n, real_type *distances) |
template<typename real_type , typename vector3_type , typename matrix3x3_type > | |
unsigned int | box_box_improved (vector3_type p_a, matrix3x3_type R_a, vector3_type const &ext_a, vector3_type p_b, matrix3x3_type R_b, vector3_type const &ext_b, real_type const &envelope, vector3_type *p, vector3_type &n, real_type *distances) |
template<typename coordsys_type , typename box_type , typename sphere_type , typename real_type , typename vector3_type > | |
bool | box_sphere (coordsys_type const &BtoWCS, coordsys_type const &StoWCS, box_type const &box, sphere_type const &sphere, real_type const &envelope, vector3_type &p, vector3_type &n, real_type &distance) |
template<typename obb_tree_types > | |
bool | obb_tree_obb_tree (typename obb_tree_types::coordsys_type const &Awcs, typename obb_tree_types::bvh_type const &A, typename obb_tree_types::coordsys_type const &Bwcs, typename obb_tree_types::bvh_type const &B, typename obb_tree_types::result_type &results) |
template<typename coordsys_type , typename plane_type , typename box_type , typename real_type , typename vector3_type > | |
int | plane_box (coordsys_type const &PtoWCS, coordsys_type const &BtoWCS, plane_type const &plane, box_type const &box, real_type const &envelope, vector3_type *p, vector3_type &n, real_type *distance) |
template<typename coordsys_type , typename plane_type , typename sdf_geometry_type , typename contact_point_container > | |
bool | plane_sdf (coordsys_type const &wcsP, plane_type const &plane, coordsys_type const &wcsG, sdf_geometry_type const &geometry, contact_point_container &contacts, double envelope=0.01) |
template<typename point_iterator , typename aabb_tree_geometry , typename contact_point_container > | |
void | points_aabb_tree (point_iterator begin, point_iterator end, aabb_tree_geometry const &aabb_tree, contact_point_container &contacts) |
template<typename vector3_type > | |
bool | ray_aabb (vector3_type const &p, vector3_type const &r, vector3_type const &min_coord, vector3_type const &max_coord) |
template<typename vector3_type , typename aabb_type > | |
bool | ray_aabb (vector3_type const &p, vector3_type const &r, aabb_type const &aabb) |
template<typename ray_type , typename aabb_type > | |
bool | ray_aabb (ray_type const &ray, aabb_type const &aabb) |
template<typename vector3_type > | |
bool | ray_obb (vector3_type const &p, vector3_type const &r, vector3_type const &c, vector3_type const &a0, vector3_type const &a1, vector3_type const &a2, vector3_type const &e) |
template<typename vector3_type , typename obb_type > | |
bool | ray_obb (vector3_type const &p, vector3_type const &r, obb_type const &obb) |
template<typename ray_type , typename obb_type > | |
bool | ray_obb (ray_type const &ray, obb_type const &obb) |
template<typename vector3_type , typename real_type > | |
bool | ray_triangle (vector3_type const &p, vector3_type const &r, vector3_type const &p0, vector3_type const &p1, vector3_type const &p2, real_type &t) |
template<typename vector3_type , typename triangle_type > | |
bool | ray_triangle (vector3_type const &p, vector3_type const &r, triangle_type const &triangle) |
template<typename ray_type , typename triangle_type > | |
bool | ray_triangle (ray_type const &ray, triangle_type const &triangle) |
template<typename coordsys_type , typename sdf_geometry_type , typename contact_point_container , typename real_type > | |
bool | sdf_sdf (coordsys_type const &AtoWCS, sdf_geometry_type const &A, coordsys_type const &BtoWCS, sdf_geometry_type const &B, contact_point_container &contacts, real_type const &envelope) |
template<typename coordsys_type , typename sphere_type , typename plane_type , typename real_type , typename vector3_type > | |
bool | sphere_plane (coordsys_type const &StoWCS, coordsys_type const &PtoWCS, sphere_type const &sphere, plane_type const &plane, real_type const &envelope, vector3_type &p, vector3_type &n, real_type &distance) |
template<typename coordsys_type , typename sdf_geometry_type , typename sphere_type , typename contact_point_container > | |
bool | sphere_sdf (coordsys_type &wcsS, sphere_type const &sphere, coordsys_type &wcsG, sdf_geometry_type const &geometry, contact_point_container &contacts, double envelope=0.01) |
template<typename vector3_type , typename real_type > | |
bool | sphere_sphere (vector3_type const &cA, real_type const &rA, vector3_type const &cB, real_type const &rB, real_type const &envelope, vector3_type &p, vector3_type &n, real_type &distance) |
void OpenTissue::collision::aabb_tree_against_itself | ( | aabb_tree_geometry const & | aabb_tree, | |
contact_point_container & | contacts | |||
) |
AABB Tree Collision Query.
This method assumes that the AABB tree have been refitted prior to invokation.
aabb_tree | ||
contacts |
unsigned int OpenTissue::collision::box_box | ( | vector3_type | p_a, | |
matrix3x3_type | R_a, | |||
vector3_type const & | a, | |||
vector3_type | p_b, | |||
matrix3x3_type | R_b, | |||
vector3_type const & | b, | |||
real_type const & | envelope, | |||
vector3_type * | p, | |||
vector3_type & | n, | |||
real_type * | distances | |||
) |
Box Box Collision Test.
The collision test is based on a separation axis test, which works great for detecting whether there is a collision or not.
Following this a separation axis is chosen to as the contact normal direction, however in some cases such as when penetrations are signigicant and when objects are slightly unaligned, a edge-edge separation axis is chosen eventhough a face normal would have been far better. This is a problem since the generated contact in these edge-edge cases might not even lie inside the contact region.
Therefor we recommend only using this method when penetrations are expected to be very small.
p_a | Center of box A in WCS. | |
p_b | Center of box B in WCS | |
R_a | Box A's orientation in WCS | |
R_b | Box B's orientation in WCS | |
a | Extents of box A, i.e. half edge sizes. | |
b | Extents of box B, i.e. half edge sizes. | |
envelope | The size of the collision envelope. If cloest point are separted by more than this distance then there is no contact. | |
p | Pointer to array of contact points, must have room for at least eight vectors. | |
n | Upon return this argument holds the contact normal pointing from box A towards box B. | |
distance | Pointer to array of separation (or penetration) distances. Must have room for at least eight values. |
unsigned int OpenTissue::collision::box_box_improved | ( | vector3_type | p_a, | |
matrix3x3_type | R_a, | |||
vector3_type const & | ext_a, | |||
vector3_type | p_b, | |||
matrix3x3_type | R_b, | |||
vector3_type const & | ext_b, | |||
real_type const & | envelope, | |||
vector3_type * | p, | |||
vector3_type & | n, | |||
real_type * | distances | |||
) |
Improved Box Box Collision Test.
p_a | Center of box A in WCS. | |
p_b | Center of box B in WCS | |
R_a | Box A's orientation in WCS | |
R_b | Box B's orientation in WCS | |
ext_a | Extents of box A, i.e. half edge sizes. | |
ext_b | Extents of box B, i.e. half edge sizes. | |
envelope | The size of the collision envelope. If cloest point are separted by more than this distance then there is no contact. | |
p | Pointer to array of contact points, must have room for at least eight vectors. | |
n | Upon return this argument holds the contact normal pointing from box A towards box B. | |
distance | Pointer to array of separation (or penetration) distances. Must have room for at least eight values. |
bool OpenTissue::collision::box_sphere | ( | coordsys_type const & | BtoWCS, | |
coordsys_type const & | StoWCS, | |||
box_type const & | box, | |||
sphere_type const & | sphere, | |||
real_type const & | envelope, | |||
vector3_type & | p, | |||
vector3_type & | n, | |||
real_type & | distance | |||
) |
Box Sphere Collision Test.
BtoWCS | Box model frame to World Coordinate Transformation. | |
StoWCS | Sphere model frame to World Coordinate Transformation. | |
box | The box geometry in its model frame. | |
sphere | The sphere geometry in its model frame. | |
envelope | The size of the collision envelope. If clostest point are separted by more than this distance then there is no contact. | |
p | Upon return this argument holds the point of contact. | |
n | Upon return this argument holds the contact normal pointing from the box towards the sphere. | |
distance | Upon return this argument holds the separation (or penetration) distance. |
bool OpenTissue::collision::obb_tree_obb_tree | ( | typename obb_tree_types::coordsys_type const & | Awcs, | |
typename obb_tree_types::bvh_type const & | A, | |||
typename obb_tree_types::coordsys_type const & | Bwcs, | |||
typename obb_tree_types::bvh_type const & | B, | |||
typename obb_tree_types::result_type & | results | |||
) |
int OpenTissue::collision::plane_box | ( | coordsys_type const & | PtoWCS, | |
coordsys_type const & | BtoWCS, | |||
plane_type const & | plane, | |||
box_type const & | box, | |||
real_type const & | envelope, | |||
vector3_type * | p, | |||
vector3_type & | n, | |||
real_type * | distance | |||
) |
Plane Box Collision Test.
PtoWCS | Plane model frame to World Coordinate Transformation. | |
BtoWCS | Box model frame to World Coordinate Transformation. | |
plane | The plane geometry in its model frame. | |
box | The box geometry in its model frame. | |
envelope | The size of the collision envelope. If clostest point are separted by more than this distance then there is no contact. | |
p | Pointer to array of contact points, must have room for at least three vectors. | |
n | Upon return this argument holds the contact normal pointing from the plane towards the box. | |
distance | Pointer to array of separation (or penetration) distances. Must have room for at least three values. |
bool OpenTissue::collision::plane_sdf | ( | coordsys_type const & | wcsP, | |
plane_type const & | plane, | |||
coordsys_type const & | wcsG, | |||
sdf_geometry_type const & | geometry, | |||
contact_point_container & | contacts, | |||
double | envelope = 0.01 | |||
) |
Test Signed Distance Map against plane.
The current implementation simply test every sample point against the specified plane. This is very naive and not very efficient. It would be much faster to test the BVH of the signed distance field geometry against the plane geometry. This is left for future optimization.
wcsP | The world location of the plane geometry. | |
plane | The object A geometry ( a plane). | |
wcsG | The world location of the signed distance field geometry. | |
geometry | The object B geometry (signed distance field). | |
contacts | Upon return holds all the contact points between the two object. By convention contact normals alway point from plane object towards sdf object. | |
envelope | The size of the collision envelope, default value is 0.01. Whenever objects are within this distance then contact points will be generated. |
void OpenTissue::collision::points_aabb_tree | ( | point_iterator | begin, | |
point_iterator | end, | |||
aabb_tree_geometry const & | aabb_tree, | |||
contact_point_container & | contacts | |||
) |
AABB Tree Collision Query. This method assumes that the two AABB trees have been refitted prior to invokation.
begin | ||
end | ||
aabb_tree | ||
contacts |
bool OpenTissue::collision::ray_aabb | ( | vector3_type const & | p, | |
vector3_type const & | r, | |||
vector3_type const & | min_coord, | |||
vector3_type const & | max_coord | |||
) | [inline] |
Ray AABB Collision Test.
p | Origin of ray. | |
r | Ray direction vector. | |
min_coord | Minimum coordinate corner of aabb. | |
max_coord | Maximum coordinate corner of aabb. |
bool OpenTissue::collision::ray_aabb | ( | vector3_type const & | p, | |
vector3_type const & | r, | |||
aabb_type const & | aabb | |||
) | [inline] |
bool OpenTissue::collision::ray_aabb | ( | ray_type const & | ray, | |
aabb_type const & | aabb | |||
) | [inline] |
bool OpenTissue::collision::ray_obb | ( | vector3_type const & | p, | |
vector3_type const & | r, | |||
vector3_type const & | c, | |||
vector3_type const & | a0, | |||
vector3_type const & | a1, | |||
vector3_type const & | a2, | |||
vector3_type const & | e | |||
) |
Ray OBB Collision Test.
p | origin of ray. | |
r | ray direction vector. | |
c | Center of OBB. | |
a0 | First axis of OBB. | |
a1 | Second axis of OBB. | |
a2 | Third axis of OBB. | |
e | Half extend of OBB. |
bool OpenTissue::collision::ray_obb | ( | vector3_type const & | p, | |
vector3_type const & | r, | |||
obb_type const & | obb | |||
) |
bool OpenTissue::collision::ray_obb | ( | ray_type const & | ray, | |
obb_type const & | obb | |||
) |
bool OpenTissue::collision::ray_triangle | ( | vector3_type const & | p, | |
vector3_type const & | r, | |||
vector3_type const & | p0, | |||
vector3_type const & | p1, | |||
vector3_type const & | p2, | |||
real_type & | t | |||
) |
Ray Triangle Collision Test.
p | origin of ray. | |
r | ray direction vector. | |
p0 | First point of triangle. | |
p1 | Second point of triangle. | |
p2 | Third point of triangle. | |
t | The ray parameter value at the point of collision (if any). |
bool OpenTissue::collision::ray_triangle | ( | vector3_type const & | p, | |
vector3_type const & | r, | |||
triangle_type const & | triangle | |||
) |
bool OpenTissue::collision::ray_triangle | ( | ray_type const & | ray, | |
triangle_type const & | triangle | |||
) |
bool OpenTissue::collision::sdf_sdf | ( | coordsys_type const & | AtoWCS, | |
sdf_geometry_type const & | A, | |||
coordsys_type const & | BtoWCS, | |||
sdf_geometry_type const & | B, | |||
contact_point_container & | contacts, | |||
real_type const & | envelope | |||
) |
Signed Distance Field Geometry Collision Query.
AtoWCS | The world location of the geometry of object A. | |
A | The geometry of object A. | |
BtoWCS | The world location of the geometry of object B. | |
B | The geometry of object B. | |
contacts | Upon return holds all the contact points between the two object. By convention contact normals alway point from object A towards object B. | |
envelope | The size of the collision envelope. Whenever objects are within this distance then contact points will be generated. |
bool OpenTissue::collision::sphere_plane | ( | coordsys_type const & | StoWCS, | |
coordsys_type const & | PtoWCS, | |||
sphere_type const & | sphere, | |||
plane_type const & | plane, | |||
real_type const & | envelope, | |||
vector3_type & | p, | |||
vector3_type & | n, | |||
real_type & | distance | |||
) |
Sphere Plane Collision Test.
PtoWCS | Plane to world coordinate transformation. | |
StoWCS | Sphere to world coordinate transformation. | |
plane | The plane geometry. | |
sphere | The sphere geometry. | |
envelope | The collision envelope, if closest points are separated more than this distance, then no contact is generated. | |
p | Upon return this argument holds the point of contact in WCS. | |
n | Upon return this argument holds the normal of the contact in WCS. Pointing from Plane towards sphere. | |
distance | Upon return this argument holds separation (or penetration) distance of the contact. Think of it as an overlap measure along the contact normal. |
bool OpenTissue::collision::sphere_sdf | ( | coordsys_type & | wcsS, | |
sphere_type const & | sphere, | |||
coordsys_type & | wcsG, | |||
sdf_geometry_type const & | geometry, | |||
contact_point_container & | contacts, | |||
double | envelope = 0.01 | |||
) |
Test Sphere Against Signed Distance Map.
wcsS | The world location of the sphere geometry. | |
wcsG | The world location of the signed distance field geometry. | |
sphere | The geometry of object A (the sphere geometry). | |
geometry | The geometry of object B ( the signed distance field geometry). | |
contacts | Upon return holds all the contact points between the two object. By convention contact normals always point from sdf object towards sphere object. | |
envelope | The size of the collision envelope, default value is 0.01. Whenever objects are within this distance then contact points will be generated. |
bool OpenTissue::collision::sphere_sphere | ( | vector3_type const & | cA, | |
real_type const & | rA, | |||
vector3_type const & | cB, | |||
real_type const & | rB, | |||
real_type const & | envelope, | |||
vector3_type & | p, | |||
vector3_type & | n, | |||
real_type & | distance | |||
) |
Sphere Sphere Collision Test.
cA | Center of sphere A in world coordinate system. | |
rA | Radius of sphere A. | |
cB | Center of sphere B in world coordinate system. | |
rB | Radius of sphere B. | |
envelope | The collision envelope, if closest points are separated more than this distance, then no contact is generated. | |
p | Upon return this argument holds the point of contact in WCS. | |
n | Upon return this argument holds the normal of the contact in WCS. Poiting from sphere A towards sphere B. | |
distance | Upon return this argument holds separation (or penetration) distance of the contact. Think of it as an overlap measure along the contact normal. |