Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qualify "coplanar" in the documentation #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pboyer
Copy link

@pboyer pboyer commented Oct 5, 2019

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:

csg.js/csg.js

Line 439 in a8512af

var type = (t < -CSG.Plane.EPSILON) ? BACK : (t > CSG.Plane.EPSILON) ? FRONT : COPLANAR;
)

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.

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.
@pboyer pboyer changed the title Qualify "coplanar" statement in documentation Qualify "coplanar" in the documentation Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant