You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! Thanks for the report. An example would be useful here - though CSG will likely not be working nicely with degenerate triangles in the first place and should probably be removed before operating. However I understand that's not always easily doable or may even occur during a previous operation.
Up until about a month ago this is how three.js' raycasting worked, which this library aims to reproduce the results of exactly. The new barycoord attribute sampling implementation I added to three.js about a month ago should solve this issue but will instead result in a 0, 0, 0 barycoordinate value (and therefore 0, 0, 0 value for interpolated uv, normal, etc).
I'd prefer not to make breaking changes to accommodate such a recent three.js release (eg we should avoid using the getInterpolatedAttribute function) but if you'd like to submit a PR that updates the the raycasting to align with three.js' behavior (ie just add some null checks) we can get that merged.
Describe the bug
There are usages of Three.js's
Triangle.getInterpolation(...)
in this library that can result in a Null-Pointer-Exception.The documentation (https://threejs.org/docs/index.html?q=Triangle#api/en/math/Triangle.getInterpolation) says:
What is a degenerate triangle? https://en.wikipedia.org/wiki/Degeneracy_(mathematics)#:~:text=A%20degenerate%20triangle%20is%20a,angle%20and%20two%20undefined%20angles.
E.g. https://github.com/search?q=repo%3Agkjohnson%2Fthree-mesh-bvh+intersection.normal&type=code
In my case the code or my meshes have provided a degenerate triangle which returned
null
.It could be that other usages are affected too:
https://github.com/search?q=repo%3Agkjohnson%2Fthree-mesh-bvh+getInterpolation&type=code
To Reproduce
Sadly I am currently not able to provide an example. Hopefully I can provide some in a few days.
Expected behavior
There should be null checks and a logically fallback. Or at least some precheck to prevent this error.
Platform:
The text was updated successfully, but these errors were encountered: