This post is the gathering of old posts getting far from their original topic to a new one :
The ability to have some facet data for any mesh, like facet normal data, facet position data, facet area data, etc, etc
For now, it's still a prototype.
Here you have the facet normal and position data used. More over a (naive and simple) internal octree is built by giving its number of subdivisions per axis (because the octree can't know the mesh geometry a priori) at the line 230. I add
PR just submitted
in short :
Brand new feature : Mesh Facet Data
Examples :
mesh.updateFacetData(); // enables and computes the facet data for this mesh
// this can be called on demand, if the mesh is
// morphed for instance, even in the render loop
// get the index of the closest facet to (x, y, z) in the world
var i = mesh.getClosestFacetAtCoordinates(x, y, z);
var position = mesh.getFacetPosition(i); // returns t