jMonkeyEngine / jMonkeyEngine/jmonkeyengine
Possible floating point precision issue in corner case using BoundingBox.clip()
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 14
Description
While working on getting jme compiled to javascript I've encountered an issue: clicks went through some ui elements (lemur).
After a very long debugging session i've isolated the problem to a floating point precision issue in BoundingBox.clip that happens when bounding boxes have zExtent=0.
As you can see, in this code there is a note by @pspeed42 regarding a similar issue that he fixed in the past.
My assumption is that, the way floating point numbers are represented in javascript (doubles?) caused this issue to reappear when the engine was compiled with teavm. I've ended up fixing it in this way.
I’m opening this issue to make it searchable in the future, in case this corner case ever arises during normal use of jME.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with jme3-core/src/main/java/com/jme3/bounding/BoundingBox.java at the referenced BoundingBox.clip() code around lines 1015-1073, including the nearby note about a similar precision issue. Reproduce the zExtent=0 corner case and compare the behavior with the linked workaround; done means the precision problem is confirmed and a project-level resolution is documented or implemented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100