pygfx.geometries¶
Containers for geometry data.
A geometry object contains the data that defines (the shape of) the object, such as positions, plus data associated with these positions (normals, texcoords, colors, etc.).
Its attributes are Buffer and Texture(View) objects. The data can be provided as keyword arguments, which are converted to numpy arrays and wrapped in a Buffer if necessary.
The names for these attributes are standardized so that the renderers know what to expect. Each material requires certain attributes to be present, and may support optional attributes. Optional attributes must always be “turned on” on the material; their presence on the geometry does not mean that they’re used.
The standardized names are:
indices
: An index into per-vertex data. Typically Nx3 for mesh geometry.positions
: Nx3 positions (xyz), defining the location of e.g. vertices or points.normals
: Nx3 normal vectors. These may or may not be unit.texcoords
: Texture coordinates used to lookup the color for a vertex.Can be Nx1, Nx2 or Nx3, corresponding to a 1D, 2D and 3D texture map.
colors
: Per-vertex colors. Must be NxM, with M 1-4 for gray,gray+alpha, rgb, rgba, respectively.
sizes
: Scalar size per-vertex.grid
: A 2D or 3D Texture that contains a regular grid of data, i.e. for images and volumes.
Basic Geometry
|
Generate a box (rectangular cuboid). |
|
Generate a cylinder or a cylinder segment. |
|
Generate a cone or a cone segment. |
|
Generate a sphere. |
|
Generate a plane. |
|
Generic container for Geometry data. |
Text Geometry
|
Geometry specific for representing text. |
|
A formatted piece of text. |
Other/Special Geometry
|
Convert a Trimesh geometry object to pygfx geometry. |
|
Generate a octahedron. |
|
Generate a icosahedron. |
|
Generate a dodecahedron. |
|
Generate a tetrahedron. |
|
Generate a torus knot. |
|
Generate a Klein bottle. |