Three.js: box3.intersectsPlane bug

Created on 3 Sep 2018  ·  3Comments  ·  Source: mrdoob/three.js

In the following example, the plane obviously intersects with the box, but the function intersectsPlane returns false.
example
I find that adding two negative sign before both of the plane.constant can fix the bug.
https://github.com/mrdoob/three.js/blob/c570b9bd95cf94829715b2cd3a8b128e37768a9c/src/math/Box3.js#L387
Also, I think the definition of the constant of the plane is not distinct, which cause the bug.

Three.js version
  • [x] Dev
  • [x] r96
  • [x] ...
Browser
  • [x] All of them
OS
  • [x] All of them
Bug

Most helpful comment

The test was wrong, too. Fixed in #14836

All 3 comments

Good find! Would you like to do a PR with the fix? It would be great if you also adjust the wrong unit test.

Also, I think the definition of the constant of the plane is not distinct, which cause the bug

three.js uses Hessian Normal Form, a common way to specify planes. I think okay to stick with that.

@Mugen87 Something is wrong, then. Can you please figure out why your unit test did not catch this. #7445

The test was wrong, too. Fixed in #14836

Was this page helpful?
0 / 5 - 0 ratings