From 1c6543e68532755055bc2c8bc4405e9b1c2a0d38 Mon Sep 17 00:00:00 2001 From: Peter Boyer Date: Sat, 5 Oct 2019 17:01:55 -0400 Subject: [PATCH] Qualify "coplanar" statement in documentation The code (specifically line https://github.com/evanw/csg.js/blob/a8512afbac3cf503195870f7ef11c0a32f36c6d4/csg.js#L439) uses the word "coplanar" in two ways: coplanarity of polygons with the same direction normal and and coplanarity of polygons with reversed normal directions. The documentation, on the other hand, uses it in one specific way: coplanar polygons with the same normal direction but doesn't quality this word. `clipTo` returns faces with the same normal direction, but removes coplanar polygons with a reversed normal (unless the BSP is degenerate). I think this statement is key to understanding the algorithm correctly, so I think this deserves to be added. --- csg.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/csg.js b/csg.js index 17b7a2f..5aaa14c 100644 --- a/csg.js +++ b/csg.js @@ -23,10 +23,11 @@ // b.clipTo(a); // a.build(b.allPolygons()); // -// The only tricky part is handling overlapping coplanar polygons in both trees. -// The code above keeps both copies, but we need to keep them in one tree and -// remove them in the other tree. To remove them from `b` we can clip the -// inverse of `b` against `a`. The code for union now looks like this: +// The only tricky part is handling overlapping coplanar (same normal direction) +// polygons in both trees. The code above keeps both copies, but we need to keep +// them in one tree and remove them in the other tree. To remove them from `b` we +// can clip the inverse of `b` against `a`. The code for union now looks like +// this: // // a.clipTo(b); // b.clipTo(a);