I have a large model (roughly 400k faces) and a large number of points on this model (roughly 2000) and I need to calculate a normal per point based on the closest face on the model. Is there a faster way that isn't O(n*m) where n is the number of points and m is the number of faces (e.g., raycasting or iterating through every face)?

I'm using THREE.js and the target hardware is a Toshiba tablet with Intel integrated graphics so I don't have a lot of power to work with. Currently if I compute this on load it takes about 10+ minutes.

I've been given the requirement that there shouldn't be any model specific information precomputed for each point so that we can use the points on a different model without recomputing everything and then have multiple datasets of point => normal mappings. This is currently what we are doing and it works but doesn't scale well to our needs.

  • \$\begingroup\$ What do you mean with "closest face on the model"? The closest face from every point (not connected to the point itself)? Or the closest face from a certain perspective? \$\endgroup\$ – PSquall Jun 13 '18 at 10:41

Maybe you can set a number of raycasts from each point to different directions. Each raycast will return the closest face. You can than iterate through those. I know it is not a 100% satisfying solution, but maybe it will be good enough for your need?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.