Basic Principle of Collision Detection¶
STL File Format¶
STL is a file format native to the stereolithography CAD software created by 3D Systems. An STL file describes a raw, unstructured triangulated surface by the unit normal and vertices of the triangles using a three-dimensional Cartesian coordinate system.
In Mech-Viz projects, the end effector model and the scene object model are usually in STL format, as shown below.
Principle of Collision Detection When Using Models in STL Format¶
A STL file describes 3D objects based on triangle meshes and only contains surface information. In this case, when using a model in STL format in collision detection, only the collision/intersection between the points and the triangle meshes on the surface of the model will be detected. The points inside the model will not be included in the computation of collision detection. The figure below shows an model in STL format.
As shown in the figure below, the yellow part indicates the triangle mesh where a collision occur, and the orange part indicates the point cloud that collides with the collision model.
OBJ File Format¶
An OBJ file may contain vertex data, free-form curve/surface attributes, elements, free-form curve/surface body statements, connectivity between free-form surfaces, grouping and display/render attribute information. The most common elements are geometric vertices, texture coordinates, vertex normals and polygonal faces. Simply put, models in STL format can be seen as void, while models in OBJ formats can be seen as solid. The figure below shows a model in OBJ format.
Note
Since OBJ files are saved in plain text, you can open them with a text editor, such as Microsoft Notepad (Windows) or Apple TextEdit (Mac), or a source code editor. You may need to rename the .obj file extension to .txt for the text editor to recognize it.
Principle of Collision Detection When Using Models in OBJ Format¶
When using a model file in OBJ format in collision detection, the end effector model will be divided into multiple “solid” convex polyhedra first, and then Mech-Viz will compute the intersection between the points and convex polyhedra. The points inside the end effector model will be included in the computation as well, and the detection result will be more accurate.
As shown in the figure below, the orange part indicates where the collision occurs.