-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
Hello,
I've been learning how THREE-CSGMesh works in an attempt to improve the performance when dealing with a large number of objects.
As an example, making 14 holes in a plate/cube (as shown below), with the current subtract function, it will need to create a total of ~28 BSP trees (a/b nodes in the function).

By adding support for an array of CSG objects, I'm able to cut down the total operation time from ~1.9 seconds to ~0.21 seconds as it only creates ~15 BSP trees for the above example:
subtract(csg) {
let a = new Node(this.clone().polygons);
a.invert();
if (csg.isCSG) {
csg = [csg];
}
for (let i = 0; i < csg.length; i++) {
let b = new Node(csg[i].clone().polygons);
a.clipTo(b);
b.clipTo(a);
b.invert();
b.clipTo(a);
b.invert();
a.build(b.allPolygons());
}
a.invert();
return CSG.fromPolygons(a.allPolygons());
}
What are your thoughts on this? are there any downsides I'm not seeing?
Thanks,
Gilad
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels