8000 BUG: Do not correct orientation of triangles returned by Qhull by ianthomas23 · Pull Request #4444 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

BUG: Do not correct orientation of triangles returned by Qhull #4444

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

Conversation

ianthomas23
Copy link
Member

Fix for issue #4437.

Up until now whenever you create an mpl Triangulation the code checks that all triangles have vertices ordered in an anticlockwise manner; if they are ordered clockwise it flips them so they are anticlockwise. This is unnecessary for a triangulation returned by Qhull as the triangles are already correctly oriented. The OP's example shows that not only is it unnecessary, but in some cases it is erroneous to do so.

Qhull can return nearly flat triangles if there are nearly colinear points. This is usual in computational geometry problems with finite machine precision. You can't really check the orientation of the vertices for a nearly flat triangle as it essentially comes down to calculating the area which can be +0.0 or indeed -0.0 for a flat triangle. If Qhull correctly gives us a correctly-oriented flat triangle but we measure the area to be -0.0, we flipped the triangle making the whole triangulation invalid.

This PR stops the orientation check for triangles returned by Qhull, and adds a test based on the OP's example. It will also need to go in master, but it cannot be cherry-picked as CXX has been removed in master so I will write a new PR for that.

@tacaswell tacaswell added this to the Color overhaul milestone May 19, 2015
tacaswell added a commit that referenced this pull request May 21, 2015
…tion

FIX: Do not correct orientation of triangles returned by Qhull
@tacaswell tacaswell merged commit 124472d into matplotlib:color_overhaul May 21, 2015
@tacaswell
Copy link
Member

@ianthomas23 Thanks!

@divenex
Copy link
divenex commented May 29, 2015

@ianthomas23 this makes sense, thank you for the fix!

@tacaswell tacaswell modified the milestones: Color overhaul, next major release (2.0) Oct 26, 2015
@QuLogic
Copy link
Member
QuLogic commented Oct 16, 2016

Actually in 1.5.0 via 178d453.

@QuLogic QuLogic modified the milestones: v1.5.0, 2.0 (style change major release) Oct 16, 2016
@ianthomas23 ianthomas23 deleted the 4437_qhull_triangle_orientation branch July 8, 2021 18:21
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.

4 participants
0