-
-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Hello there,
I noticed a strong performance slowdown for CSG operations when sides of the objects lie within each other.
The following example demonstrates the issue.
Setting varyHeight to true results in a total processing time of about 100ms on my system.
Setting varyHeight to false however results in the ends of the cylinders to overlap with many coplanar triangles and a processing time of about 300 seconds, about three thousand times slower than the version with varying heights.
const varyHeight = true;
const numCylinders = 3;
const cylinders = [];
for (let i = 0; i < numCylinders; i++) {
const geometry = new THREE.CylinderGeometry(1.5, 1.5, 3, 48, 1);
geometry.translate(i, varyHeight ? i * 0.01 : 0, 0);
cylinders.push(geometry);
}
const evaluator = new CSG.Evaluator();
let result = new CSG.Brush(cylinders[0]);
console.time("CSG total");
for (let i = 1; i < numCylinders; i++) {
console.time("CSG " + i);
result = evaluator.evaluate(result, new CSG.Brush(cylinders[i]), CSG.ADDITION);
console.timeEnd("CSG " + i);
}
console.timeEnd("CSG total");
scene.add(result);Is there anything one can do to avoid this issue other than avoiding coplanar triangles at all?
Best regards,
Marc
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working