-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
EarClipping algorithm improved + typing error in Clipper3D #130
Conversation
Hi Marc, Could you please add an unit test to show that the old implementation failed and this one now works where the old one worked + the new case? Thanks! |
I try to prepare an unit test for the earClipping algorithm. I also put a spelling correction into this commit by mistake that led to a compiler error with MSVC 2010; I don't think that there is a unit test necessary. For the unit-test, is it right to add a new source file in \pcl\test\surface and implement the test based on gtest there? |
So, now I added a test EarClippingCubeTest to the existing "test_ear_clipping". When creating a unit cube aligned along the x,y and z axes, only the two faces (bottom and top), perpendicular to the xy-plane is recognized by the old implementation. Therefore the test already fails with the old implementation concerning the number of resulting triangles. The unit test already contained one more complex polygon that is split into triangles with the old and new implementation. I hope that helps. In general, I think that both implementations are not very robust if a polygon does not fully lie in one plane, like it is the case for the first test "EarClipping". Some slight deviations are ok, but if the points are somewhere connected in space it becomes difficult. However, this is a general problem of the ear clipping algorithm and starts with the problem, that the area of such a non-planar polygon is difficult to determine. |
Why is there a piece of commented code in the commit?
|
Hi Radu, right now, I commented this part, because there are two possible implementations in the method isInsideTriangle. The first (currently active) implementation is faster however difficult to understand. Nevertheless, this is the common method also used by other rendering algorithms. The second (commented) method, is more straigt-forward and better to understand and uses the commented method sameSide. It is no problem for me to totally delete the second, slower and currently commented method. Cheers |
Hi Marc, please don't mix two things in one pull request but rather use different branches. I will cherry pick the 5b59df8 into master and next, as this seems to be an important fix. The rest needs some more time, I think. |
@magro11 Could you update the pull request according to the comments? Thanks a lot! |
Hi Jochen, |
@magro11 please don't include merges in your pull request. Just do a force push to your branch. |
…ng the same x or y component.
So now, I reverted my old stuff and put all my changes concering the earClipping algorithm to the commit f52192a. Hope this helps. |
Looks good to me! |
Should be good I guess. If you tested it and it improves the results. |
EarClipping algorithm improved + typing error in Clipper3D
Due to a commit-mistake, I mixed two different pull request in this one:
Sorry about mixing about two different things, but the first one is really tiny.