A straightforward C++ openFrameworks addon to check if a 3D point (ofVec3f) is inside a closed 3D ofMesh. To determine this, it uses the Möller–Trumbore ray-triangle intersection algorithm.
Use ofxPointInMesh's static method by passing a point and a mesh as arguments:
bool isInside = ofxPointInMesh::isInside(thePoint, theMesh);
Also see the examples. Project files for Windows Code::Blocks are included. You can use openFrameworks' ProjectGenerator to generate project files for other IDE's.
Distributed under the MIT License.
Download/clone the addon into the
Developed under OF 0.8.4.
The ofMesh mode must be OF_PRIMITIVE_TRIANGLES to use this addon. Assumes, but doesn't check, it is a closed 3D mesh. For bugs, please use this repository's issue tracker.
Version 0.1.0 (17.04.2015):
- Initial version
- Supports a single point-in-mesh method
- Includes two examples (pointsInBox and pointsInSphere)