| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| ``Poly3DCollection`` supports shading | ||
| ------------------------------------- | ||
|
|
||
| It is now possible to shade a `.Poly3DCollection`. This is useful if the | ||
| polygons are obtained from e.g. a 3D model. | ||
|
|
||
| .. plot:: | ||
| :include-source: true | ||
|
|
||
| import numpy as np | ||
| import matplotlib.pyplot as plt | ||
| from mpl_toolkits.mplot3d.art3d import Poly3DCollection | ||
|
|
||
| # Define 3D shape | ||
| block = np.array([ | ||
| [[1, 1, 0], | ||
| [1, 0, 0], | ||
| [0, 1, 0]], | ||
| [[1, 1, 0], | ||
| [1, 1, 1], | ||
| [1, 0, 0]], | ||
| [[1, 1, 0], | ||
| [1, 1, 1], | ||
| [0, 1, 0]], | ||
| [[1, 0, 0], | ||
| [1, 1, 1], | ||
| [0, 1, 0]] | ||
| ]) | ||
|
|
||
| ax = plt.subplot(projection='3d') | ||
| pc = Poly3DCollection(block, facecolors='b', shade=True) | ||
| ax.add_collection(pc) | ||
| plt.show() | ||
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySlightly unclear cause it's missing the general thing a 3D model is an example of.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI agree that this formulation is maybe not ideal. I was originally going to discuss things like STL-files, but since that is not the only way to represent a 3D model I kept it simple.
An option is to generate a static example loading an STL model (as we need additional libraries).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIn what cases besides a 3D model would shading be useful?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI guess that one can have some other type of 3D polygons that are not necessarily considered to be a "3D model", although in some sense all 3D polygons could be considered a "3D model". One example may be voxels? Basically something that is not representing a physical object, but a visualization of something that happens to be 3D Polygons.
But I am open for suggestions.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.