gkjohnson / three-bvh-csg

A flexible, memory compact, fast and dynamic CSG implementation on top of three-mesh-bvh
MIT License
601 stars 46 forks source link

Add support for split operations #143

Closed gkjohnson closed 1 year ago

gkjohnson commented 1 year ago

Fix #105

TODO

A B Inter
SUBTRACTION X
DIFFERENCE X X
~(no op A)~ X X
ADDITION X X X
REVERSE_SUBTRACT X
~(no op B)~ X X
INTERSECTION X
gkjohnson commented 1 year ago

Adding a second accumulated geometry seems to had a lot more overhead than expected (~67%). Better than 100% but still worth profiling more.

Library Comparison mean median min max
three-bvh-csg 13.43972 ms 13.43475 ms 12.97229 ms 15.15712 ms
three-bvh-csg w/ rebuild 32.25614 ms 32.23792 ms 31.88738 ms 34.09613 ms
three-csg-ts 2907.59837 ms 2907.59837 ms 2870.47858 ms 2944.71817 ms
three-csg 2936.33496 ms 2936.33496 ms 2910.51821 ms 2962.15171 ms
three-csg w/ rebuild 2909.16123 ms 2909.16123 ms 2891.77346 ms 2926.54900 ms
General mean median min max
Subtract w/ Groups 247.73790 ms 247.25962 ms 246.07883 ms 253.68025 ms
Subtract w/o Groups 246.08749 ms 245.25504 ms 244.46163 ms 248.89821 ms
Subtract w/ Inverted 410.15811 ms 409.95315 ms 407.82042 ms 412.98583 ms
gkjohnson commented 1 year ago

Before

Library Comparison mean median min max
three-bvh-csg 13.58028 ms 13.62190 ms 13.29796 ms 14.32387 ms
three-bvh-csg w/ rebuild 32.55488 ms 32.46908 ms 32.10258 ms 44.22413 ms
three-csg-ts 2936.26394 ms 2912.52719 ms 2904.86404 ms 3036.70900 ms
three-csg 2917.04453 ms 2908.69271 ms 2893.64813 ms 2955.51054 ms
three-csg w/ rebuild 2942.71065 ms 2934.00335 ms 2905.38767 ms 2988.02742 ms
General mean median min max
Subtract w/ Groups 250.10269 ms 249.71537 ms 247.17592 ms 257.31067 ms
Subtract w/o Groups 250.00015 ms 249.29862 ms 246.87450 ms 256.68650 ms

After

Library Comparison mean median min max
three-bvh-csg 13.48137 ms 13.50698 ms 13.17746 ms 15.08771 ms
three-bvh-csg w/ rebuild 32.39582 ms 32.36392 ms 31.95867 ms 42.13033 ms
three-csg-ts 2965.93874 ms 2954.55931 ms 2929.81479 ms 3012.95863 ms
three-csg 2955.84167 ms 2958.55906 ms 2920.40763 ms 2990.86162 ms
three-csg w/ rebuild 3002.27110 ms 3007.22071 ms 2927.49992 ms 3118.49229 ms
General mean median min max
Subtract w/ Groups 250.10915 ms 249.94462 ms 246.76137 ms 255.29754 ms
Subtract w/o Groups 250.65542 ms 250.22648 ms 248.68033 ms 254.88675 ms
Subtract w/ Inverted 294.59061 ms 294.02475 ms 290.30454 ms 301.86117 ms