evanw / csg.js

Constructive solid geometry on meshes using BSP trees in JavaScript
http://evanw.github.com/csg.js/
MIT License
1.79k stars 264 forks source link

Qualify "coplanar" in the documentation #26

Open pboyer opened 4 years ago

pboyer commented 4 years ago

I understand this code isn't actively maintained, but hopefully this pull request will help others understand it correctly.

The code uses the word "coplanar" to refer to two specific conditions: overlapping polygons with the same normal direction and overlapping polygons with reversed normal directions: https://github.com/evanw/csg.js/blob/a8512afbac3cf503195870f7ef11c0a32f36c6d4/csg.js#L439)

The documentation, on the other hand, uses it in one specific way: overlapping polygons with the same normal direction. But, it doesn't doesn't qualify. I think this qualification is key to understanding the algorithm correctly, so it is worth adding.

Namely, clipTo will return polygons in the argument list with the same normal direction as the CSGNode, but removes coplanar polygons with a reversed normal.