ThreeCSG icon indicating copy to clipboard operation
ThreeCSG copied to clipboard

Inverse function?

Open SelaO opened this issue 7 years ago • 6 comments

Where is the inverse function from the original CSG?

http://evanw.github.io/csg.js/docs/

SelaO avatar Jun 08 '17 07:06 SelaO

invert is present on any ThreeBSP.Node objects, the top-level one is the tree property on a ThreeBSP instance.

chandlerprall avatar Jun 08 '17 21:06 chandlerprall

What is the difference between the tree and node?

SelaO avatar Jun 09 '17 06:06 SelaO

The tree property is a node, it just happens to be the top-level node and provides access to the entire BSP tree.

chandlerprall avatar Jun 09 '17 18:06 chandlerprall

So how do you properly invert a geometry?

Doing:

const geometryCsg = new ThreeBSP(geometryThree);
geometryCsg..tree.invert();  // or geometryCsg..tree = geometryCsg..tree.invert();
geometryCsg.toGeometry();

or

let inv = geometryCsg.tree.invert(); 
let binv = new ThreeBSP(inv): 
binv.toGeometry();

Just returns the same shape as before.

SelaO avatar Jun 11 '17 08:06 SelaO

I'd expect your first code block (invert, convert to geometry) to work. Are you sure the material you're rendering with doesn't render both sides?

chandlerprall avatar Jun 13 '17 03:06 chandlerprall

@SelaO

how do you properly invert a geometry?

isnt it simply flipping normals? or, in terms of buffer geometry, swapping vertices 3n and 3n+1

makc avatar Dec 01 '19 16:12 makc