1.FCL is a library for performing three types of proximity queries on a pair of geometric models composed of triangles.
FCL is a library for performing three types of proximity queries on a pair of geometric models composed of triangles.
--Collision detection: detecting whether the two models overlap, and optionally, all of the triangles that overlap.
-Collision detection: detecting whether the two models overlap, and optionally, all of the triangles that overlap.
--Distance computation: computing the minimum distance between a pair of models, i.e., the distance between the closest pair of points.
-Distance computation: computing the minimum distance between a pair of models, i.e., the distance between the closest pair of points.
--Tolerance verification: determining whether two models are closer or farther than a tolerance distance.
-Tolerance verification: determining whether two models are closer or farther than a tolerance distance.
--Continuous collision detection: detecting whether the two moving models overlap during the movement, and optionally, the time of contact.
-Continuous collision detection: detecting whether the two moving models overlap during the movement, and optionally, the time of contact.
--Global penetration depth: detecting the minimum motion required to separate two in-collision objects, and return the configuration where the collision has been resolved.
-Global penetration depth: detecting the minimum motion required to separate two in-collision objects, and return the configuration where the collision has been resolved.
--Contact information: for collision detection, continuous collision detection and global penetration depth, the contact information (including contact normals and contact points) can be returned optionally.
-Contact information: for collision detection, continuous collision detection and global penetration depth, the contact information (including contact normals and contact points) can be returned optionally.
2. FCL has the following features
FCL has the following features
--C++ interface, heavily use the boost
- C++ interface, heavily use the boost
--Compilable for either linux or win32 (both makefiles and Microsoft Visual projects can be generated using cmake)
- Compilable for either linux or win32 (both makefiles and Microsoft Visual projects can be generated using cmake)
--No special topological constraints or adjacency information required for input models – all that is necessary is a list of the model's triangles
- No special topological constraints or adjacency information required for input models – all that is necessary is a list of the model's triangles
- Supported different object shapes:
+ sphere
+ box
+ cone
+ cylinder
+ mesh
+ octree (optional, octrees are represented using the octomap library http://octomap.github.com)
Supported shapes:
## Installation
- sphere
- box
- cone
- cylinder
- mesh
In addition, collision checking with octrees is also supported.
Octrees are represented using the octomap library http://octomap.github.com
3. Installation
CMakeLists.txt is used to generate makefiles in Linux or Visual studio projects in windows. In command line, run
CMakeLists.txt is used to generate makefiles in Linux or Visual studio projects in windows. In command line, run
``` cmake
mkdir build
mkdir build
cd build
cd build
cmake ..
cmake ..
Next, in linux, use make to compile the code. In windows, there will generate a visual studio project and then you can compile the code.
```
Next, in linux, use make to compile the code.
In windows, there will generate a visual studio project and then you can compile the code.
4. Interfaces
### Interfaces
Before starting the proximity computation, we need first to set the geometry and transform for the objects involving in computation. The geometry of an object is represented as a mesh soup, which can be set as follows:
Before starting the proximity computation, we need first to set the geometry and transform for the objects involving in computation. The geometry of an object is represented as a mesh soup, which can be set as follows:
```cpp
// set mesh triangles and vertice indices
// set mesh triangles and vertice indices
std::vector<Vec3f>vertices;
std::vector<Vec3f>vertices;
std::vector<Triangle>triangles;
std::vector<Triangle>triangles;
...
@@ -50,8 +50,10 @@ Model* model = new Model();
...
@@ -50,8 +50,10 @@ Model* model = new Model();
model->beginModel();
model->beginModel();
model->addSubModel(vertices,triangles);
model->addSubModel(vertices,triangles);
model->endModel();
model->endModel();
```
The transform of an object includes the rotation and translation:
The transform of an object includes the rotation and translation:
```cpp
// R and T are the rotation matrix and translation vector
// R and T are the rotation matrix and translation vector
Matrix3fR;
Matrix3fR;
Vec3fT;
Vec3fT;
...
@@ -59,20 +61,20 @@ Vec3f T;
...
@@ -59,20 +61,20 @@ Vec3f T;
...
...
// transform is configured according to R and T
// transform is configured according to R and T
Transform3fpose(R,T);
Transform3fpose(R,T);
```
Given the geometry and the transform, we can also combine them together to obtain a collision object instance and here is an example:
Given the geometry and the transform, we can also combine them together to obtain a collision object instance and here is an example:
```cpp
//geom and tf are the geometry and the transform of the object
//geom and tf are the geometry and the transform of the object
BVHModel<OBBRSS>*geom=...
BVHModel<OBBRSS>*geom=...
Transform3ftf=...
Transform3ftf=...
//Combine them together
//Combine them together
CollisionObject*obj=newCollisionObject(geom,tf);
CollisionObject*obj=newCollisionObject(geom,tf);
```
Once the objects are set, we can perform the proximity computation between them. All the proximity queries in FCL follow a common pipeline: first, set the query request data structure and then run the query function by using request as the input. The result is returned in a query result data structure. For example, for collision checking, we first set the CollisionRequest data structure, and then run the collision function:
Once the objects are set, we can perform the proximity computation between them. All the proximity queries in FCL follow a common pipeline: first, set the query request data structure and then run the query function by using request as the input. The result is returned in a query result data structure. For example, for collision checking, we first set the CollisionRequest data structure, and then run the collision function:
```cpp
// Given two objects o1 and o2
// Given two objects o1 and o2
CollisionObject*o1=...
CollisionObject*o1=...
CollisionObject*o2=...
CollisionObject*o2=...
...
@@ -82,14 +84,14 @@ CollisionRequest request;
...
@@ -82,14 +84,14 @@ CollisionRequest request;
CollisionResultresult;
CollisionResultresult;
// perform collision test
// perform collision test
collide(o1,o2,request,result);
collide(o1,o2,request,result);
```
By setting the collision request, the user can easily choose whether to return contact information (which is slower) or just return binary collision results (which is faster).
By setting the collision request, the user can easily choose whether to return contact information (which is slower) or just return binary collision results (which is faster).
For distance computation, the pipeline is almost the same:
For distance computation, the pipeline is almost the same:
```cpp
// Given two objects o1 and o2
// Given two objects o1 and o2
CollisionObject*o1=...
CollisionObject*o1=...
CollisionObject*o2=...
CollisionObject*o2=...
...
@@ -99,11 +101,11 @@ DistanceRequest request;
...
@@ -99,11 +101,11 @@ DistanceRequest request;
DistanceResultresult;
DistanceResultresult;
// perform distance test
// perform distance test
distance(o1,o2,request,result);
distance(o1,o2,request,result);
```
For continuous collision, FCL requires the goal transform to be provided (the initial transform is included in the collision object data structure). Beside that, the pipeline is almost the same as distance/collision:
For continuous collision, FCL requires the goal transform to be provided (the initial transform is included in the collision object data structure). Beside that, the pipeline is almost the same as distance/collision:
For global penetration depth computation, we need a pre-computation step. Beside that, the online penetration depth function uses exactly the same pipeline as shown above:
For global penetration depth computation, we need a pre-computation step. Beside that, the online penetration depth function uses exactly the same pipeline as shown above: