/ofxPointInMesh

An openFrameworks addon to check if a 3D point is inside an ofMesh

Primary LanguageC++OtherNOASSERTION

ofxPointInMesh

Introduction

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.

Usage

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.

Author

Created by Amnon Owed / @AmnonOwed

License

Distributed under the MIT License.

Installation

Download/clone the addon into the openFrameworks/addons/ folder.

Dependencies

None.

Compatibility

Developed under OF 0.8.4.

Known issues

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 history

Version 0.1.0 (17.04.2015):

  • Initial version
  • Supports a single point-in-mesh method
  • Includes two examples (pointsInBox and pointsInSphere)