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.
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 theCSGNode
, but removes coplanar polygons with a reversed normal.