Easy3D 2.6.1
Loading...
Searching...
No Matches
Collider Class Reference

Efficient collision detection. More...

#include <easy3d/algo/collider.h>

Public Member Functions

 Collider (SurfaceMesh *mesh0, SurfaceMesh *mesh1)
 
std::vector< std::pair< SurfaceMesh::Face, SurfaceMesh::Face > > detect (const mat4 &t0, const mat4 &t1) const
 

Detailed Description

Efficient collision detection.

This class takes two triangle meshes and their transformation matrices as input and outputs the intersecting face pairs. This implementation is a wrapper of Opcode. It can achieve real-time performance for large meshes.

Todo
Extension to general polygonal meshes (by internally triangulate the input).
Examples
Tutorial_406_CollisionDetection/main.cpp.

Constructor & Destructor Documentation

◆ Collider()

Collider ( SurfaceMesh * mesh0,
SurfaceMesh * mesh1 )

Constructor. It internally initializes the collider (by building the AABB trees) for subsequent efficient collision detection.

Parameters
mesh0The first mesh (must be triangle mesh).
mesh1The second mesh (must be triangle mesh).

Member Function Documentation

◆ detect()

std::vector< std::pair< SurfaceMesh::Face, SurfaceMesh::Face > > detect ( const mat4 & t0,
const mat4 & t1 ) const

Performs collision detection.

Parameters
t0The transformation of the first mesh.
t1The transformation of the second mesh.
Returns
The intersecting face pairs.

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