-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Wrong drawing Poly3DCollection #16633
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
Comments
This is currently a limitation of mplot3d, which is not really a 3D renderer, tries to heuristically create a 3D impression by drawing 2D stuff. The points a in the (projected) correct position in both cases, as you could see if you just draw the edges but no filling. However, the filling is just a 2D filling of the projection. This is in general not what one would expect from a filled 3D polygon. Speaking of which, in the general case, creating a filling for a 3D polygon is a non-trivial task and there is no unique solution. Therefore, for now, I'd declare that filling of 3D polygons is not officially supported and whether or not a filled 3D polygon looks right is pure chance. |
I wouldn't even call this a limitation of mplot3d: the polygon is simply not well defined at all. It could just as well be two parallel triangular faces connected with a rectangle. In general I think PolyCollection3D should only support triangular faces, possibly with some shortcut to split rectangles into pairs of triangles or more triangulation helpers. |
I have a slightly different point of view. A polygon is just a sequence of (connected) points. It actually does not have any faces. In 2D you can easily fill the enclosed area, in 3D there is no well-defined contained area. If you want to have surfaces, you should use plot_trisurf instead. It can already handle triangulation. |
Indeed, I should have said "don't support filled Poly3DCollections with non-triangles". |
Drawing 3D polygon with the code:
Leads to the following result on scene rotation:
While the polygon should looks like this:
Matplotlib version
print(matplotlib.get_backend())
): module://ipympl.backend_nbaggThe text was updated successfully, but these errors were encountered: