-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Triangle: Return null
in getBarycoord()
if the triangle is degenerated.
#27311
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
It seems the unit tests require an update now.
|
I just changed the function to return null. But the reality of it is that all of these functions are already returning unreasonable results if they're not checking for degenerate triangles (none of them are). If we think this is a possibility then this these functions should already be handling these cases. Documenting the possibility and returning null will hopefully make this easier to detect / understand. The biggest issue is that the result looked reasonable. |
null
if the triangle is degenerated.
null
if the triangle is degenerated. null
in getBarycoord()
if the triangle is degenerated.
* BatchedMesh: Add sorting and frustum culling for shadows * Triangle.getBarycoord: throw error if a degenerate triangle is used * Return null, instead * Fix test * Fix containsPoint
Related issue: gkjohnson/three-bvh-csg#183
Description
Previously the getBarycoord function was providing a reasonable looking result where no reasonable value could be provided when a degenerate triangle was used. This makes tracking errors down extremely difficult. Now an error will be thrown if a degenerate triangle is used.