CGAL 6.1.2 - Polygon Mesh Processing: CGAL::Rigid_triangle_mesh_collision_detection< TriangleMesh, VertexPointMap, Kernel, AABBTree, Has_rotation > Class Template Reference

CGAL 6.1.2 - Polygon Mesh Processing

Loading...
Searching...
No Matches
List of all members | Public Types | Public Member Functions
CGAL::Rigid_triangle_mesh_collision_detection< TriangleMesh, VertexPointMap, Kernel, AABBTree, Has_rotation > Class Template Reference
Reference Manual

`#include <CGAL/Rigid_triangle_mesh_collision_detection.h>`

## Definition

template<class TriangleMesh, class VertexPointMap = Default, class Kernel = Default, class AABBTree = Default, class Has_rotation = CGAL::Tag_true>
class CGAL::Rigid_triangle_mesh_collision_detection< TriangleMesh, VertexPointMap, Kernel, AABBTree, Has_rotation >

This class provides methods to perform some intersection tests between triangle meshes that undergo affine transformations (rotation, translation, and scaling).

Meshes are added to an internal set and are referenced using an id assigned when added to the set. Note that the exact predicate framework applies on the meshes after having applied the transformation to the coordinates of the points of the vertices of each mesh.

Template Parameters

  TriangleMesh | a model of `HalfedgeListGraph` and `FaceListGraph`
  VertexPointMap | a model of `ReadablePropertyMap` with the vertex descriptor of `TriangleMesh` as key type, and a point from a CGAL Kernel as value type. Default is the internal point property map of `TriangleMesh` if it exists.
  Kernel | a model of CGAL Kernel. Default is the kernel of the value type of `VertexPointMap` retrieved using `Kernel_traits`.
  AABBTree | an `AABB_tree` that can containing faces of `TriangleMesh`. Default is using `AABB_traits` with `AABB_face_graph_triangle_primitive` as primitive type.
  Has_rotation | tag indicating whether the transformations applied to meshes may contain rotations (`Tag_true`) or if only translations and scalings are applied (`Tag_false`). Some optimizations are switch on in case there are no rotations.

## Public Types
typedef unspecified_type | AABB_tree
| The AABB_tree type representing the triangles of each input mesh.
typedef unspecified_type | Vertex_point_map
| The vertex point map type used with `TriangleMesh`
typedef boost::property_traits< Vertex_point_map >::value_type | Point_3
| Point type.

## Public Member Functions
| Rigid_triangle_mesh_collision_detection (const Rigid_triangle_mesh_collision_detection &)=default
| Rigid_triangle_mesh_collision_detection (Rigid_triangle_mesh_collision_detection &&other)
| move constructor
Rigid_triangle_mesh_collision_detection & | operator= (Rigid_triangle_mesh_collision_detection &other)=default
Rigid_triangle_mesh_collision_detection & | operator= (Rigid_triangle_mesh_collision_detection &&other)
| move assignment operator
template<class NamedParameters = parameters::Default_named_parameters>
std::size_t | add_mesh (const TriangleMesh &tm, const NamedParameters &np=parameters::default_values())
| adds mesh `tm` to the set of meshes to be considered for intersection.
template<class NamedParameters = parameters::Default_named_parameters>
std::size_t | add_mesh (const AABB_tree &tree, const TriangleMesh &tm, const NamedParameters &np=parameters::default_values())
| adds an instance of a triangulated surface mesh using an external tree of its faces.
void | set_transformation (std::size_t mesh_id, const Aff_transformation_3< K > &aff_trans)
| sets the transformation associated to a mesh identified by its id in the set.
template<class MeshIdRange >
std::vector< std::size_t > | get_all_intersections (std::size_t mesh_id, const MeshIdRange &ids) const
| returns a vector of the ids of meshes within `ids` that have at least a face intersecting a face of the mesh with id `mesh_id`.
std::vector< std::size_t > | get_all_intersections (std::size_t mesh_id) const
| returns a vector of the ids of meshes in the set that have at least a face intersecting a face of the mesh with id `mesh_id`
template<class MeshIdRange >
std::vector< std::pair< std::size_t, bool > > | get_all_intersections_and_inclusions (std::size_t mesh_id, const MeshIdRange &ids) const
| returns a vector of the ids of meshes within `ids` that are intersecting with the mesh with id `mesh_id`, considering volume inclusions for closed meshes.
std::vector< std::pair< std::size_t, bool > > | get_all_intersections_and_inclusions (std::size_t mesh_id) const
| returns a vector of the ids of meshes in the set that are intersecting with the mesh with id `mesh_id`, considering volume inclusions for closed meshes.

## Memory Management
void | reserve (std::size_t size)
| increases the capacity of data structures used internally, `size` being the number of meshes expected to be added.
void | remove_mesh (std::size_t mesh_id)
| removes the mesh with id `mesh_id` from the set, the indices of other meshes are kept unchanged.
std::size_t | size () const
| returns the number of meshes in the set

## Member Function Documentation

## ◆ add_mesh() [1/2]

template<class TriangleMesh , class VertexPointMap = Default, class Kernel = Default, class AABBTree = Default, class Has_rotation = CGAL::Tag_true>
template<class NamedParameters = parameters::Default_named_parameters>

std::size_t CGAL::Rigid_triangle_mesh_collision_detection< TriangleMesh, VertexPointMap, Kernel, AABBTree, Has_rotation >::add_mesh | ( | const AABB_tree & | tree,
|  | const TriangleMesh & | tm,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

adds an instance of a triangulated surface mesh using an external tree of its faces.

Warning
  The tree is not copied and the lifetime of `tree` must be longer than that of this class.

Template Parameters

  NamedParameters | a sequence of Named Parameters

Returns
  the id of `tm` used to refer to that mesh.

Parameters

  tree | an AABB-tree of faces of a mesh
  tm | triangulated surface mesh
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the vertices of `tm` Type: a class model of `ReadWritePropertyMap` with `boost::graph_traits<TriangleMesh>::vertex_descriptor` as key type and `Point_3` as value type Default: `boost::get(CGAL::vertex_point, tm)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` should be available for the vertices of `tm`. |
  a property map associating to each face of `tm` a unique index between `0` and `num_faces(tm) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::face_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map |
  If `false`, `tm` is assumed to have only one connected component, avoiding the extraction of connected components Type: Boolean Default: `true` |

## ◆ add_mesh() [2/2]

template<class TriangleMesh , class VertexPointMap = Default, class Kernel = Default, class AABBTree = Default, class Has_rotation = CGAL::Tag_true>
template<class NamedParameters = parameters::Default_named_parameters>

std::size_t CGAL::Rigid_triangle_mesh_collision_detection< TriangleMesh, VertexPointMap, Kernel, AABBTree, Has_rotation >::add_mesh | ( | const TriangleMesh & | tm,
|  | const NamedParameters & | np = `parameters::default_values()`
| ) |  |

adds mesh `tm` to the set of meshes to be considered for intersection.

Template Parameters

  NamedParameters | a sequence of Named Parameters

Returns
  the id of `tm` used to refer to that mesh.

Parameters

  tm | triangulated surface mesh to add
  np | an optional sequence of Named Parameters among the ones listed below

Optional Named Parameters

  a property map associating points to the vertices of `tm` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<TriangleMesh>::vertex_descriptor` as key type and `Point_3` as value type Default: `boost::get(CGAL::vertex_point, tm)` Extra: If this parameter is omitted, an internal property map for `CGAL::vertex_point_t` should be available for the vertices of `tm`. |
  a property map associating to each face of `tm` a unique index between `0` and `num_faces(tm) - 1` Type: a class model of `ReadablePropertyMap` with `boost::graph_traits<PolygonMesh>::face_descriptor` as key type and `std::size_t` as value type Default: an automatically indexed internal map |
  If `false`, `tm` is assumed to have only one connected component, avoiding the extraction of connected components. Type: Boolean Default: `true` |

## ◆ get_all_intersections()

template<class TriangleMesh , class VertexPointMap = Default, class Kernel = Default, class AABBTree = Default, class Has_rotation = CGAL::Tag_true>
template<class MeshIdRange >

std::vector< std::size_t > CGAL::Rigid_triangle_mesh_collision_detection< TriangleMesh, VertexPointMap, Kernel, AABBTree, Has_rotation >::get_all_intersections | ( | std::size_t | mesh_id,
|  | const MeshIdRange & | ids
| ) |  | const

returns a vector of the ids of meshes within `ids` that have at least a face intersecting a face of the mesh with id `mesh_id`.

If `mesh_id` is in `ids` it is not reported.

Template Parameters

  MeshIdRange | a range of ids convertible to `std::size_t`.

## ◆ get_all_intersections_and_inclusions() [1/2]

template<class TriangleMesh , class VertexPointMap = Default, class Kernel = Default, class AABBTree = Default, class Has_rotation = CGAL::Tag_true>

std::vector< std::pair< std::size_t, bool > > CGAL::Rigid_triangle_mesh_collision_detection< TriangleMesh, VertexPointMap, Kernel, AABBTree, Has_rotation >::get_all_intersections_and_inclusions | ( | std::size_t | mesh_id | ) | const

returns a vector of the ids of meshes in the set that are intersecting with the mesh with id `mesh_id`, considering volume inclusions for closed meshes.

See the previous overload for details.

## ◆ get_all_intersections_and_inclusions() [2/2]

template<class TriangleMesh , class VertexPointMap = Default, class Kernel = Default, class AABBTree = Default, class Has_rotation = CGAL::Tag_true>
template<class MeshIdRange >

std::vector< std::pair< std::size_t, bool > > CGAL::Rigid_triangle_mesh_collision_detection< TriangleMesh, VertexPointMap, Kernel, AABBTree, Has_rotation >::get_all_intersections_and_inclusions | ( | std::size_t | mesh_id,
|  | const MeshIdRange & | ids
| ) |  | const

returns a vector of the ids of meshes within `ids` that are intersecting with the mesh with id `mesh_id`, considering volume inclusions for closed meshes.

More precisely, if at least one face of a mesh with id `i` intersects a face of the mesh with id `mesh_id`, the pair `(i, false)` is put in the output vector. If there is no face intersection, but at least one of the meshes with ids `i` and `mesh_id` is closed, and at least one connected component is included in the bounded volume defined by a closed mesh then the pair `(i, true)` is put in the output vector (independently of mesh `i` or `mesh_id` being the one including the other). The inclusion test is done using `Side_of_triangle_mesh`, in particular surface orientation is ignored and only the nesting level of connected components defines a bounded volume. If a mesh has some self-intersection the inclusion test may return incorrect results. If `mesh_id` is in `ids` it is not reported.

Template Parameters

  MeshIdRange | a range of ids convertible to `std::size_t`.

Note
  If a mesh is made of several connected components and at least one component is not closed, then no inclusion test will be made even if some components are closed.