react-three-csg icon indicating copy to clipboard operation
react-three-csg copied to clipboard

Bounding box of csg geometry sometimes does not match the geometry (is much more bigger)

Open btjacker opened this issue 1 year ago • 2 comments

Hi, the title says everything. If you visit the sandbox and display the console, you will see inputs for the geometry and the bounding box dimensions as three sees it:

0.45 0.45 0.3 w 1.0399999618530273 h 0.6951998419106007 l 1.2901498079299927 1 1 1 w 1.0001001192212104 h 1.0001001192212104 l 1.0001001192212104

Second line is ok, component with inputs 1,1,1 has bounding box with all dimensions 1 But component with inputs 0.45 0.45 0.3 has bigger bounding box which is wrong. This happens only for some inputs and for example if you change "const e" value, this also affects the bounding box.

codesandbox

btjacker avatar Nov 29 '23 14:11 btjacker

This is probably related to https://github.com/gkjohnson/three-bvh-csg/issues/183, which is fixed in version 0.0.15 of three-bvh-svg. So likely an upgrade of the library here would fix it

JakeDluhy avatar Dec 05 '23 16:12 JakeDluhy

This is probably related to gkjohnson/three-bvh-csg#183, which is fixed in version 0.0.15 of three-bvh-svg. So likely an upgrade of the library here would fix it

I updated the codesandbox. Wireframe now shows the bounding box and with 0.0.15 it is still the same. I have tried to produce the same behaviour with pure three but the issue did not show up. Probably because of operation order.

Even in react it behave different when I do A-(B+C+D) or A-B-C-D

EDIT: Another strange behaviour which I can not reproduce in plaint three is, that bounding box includes the object I subbstract from the base geometry sandbox

btjacker avatar Dec 06 '23 12:12 btjacker