primitive
#
Module dedicated for basic primitive.
|
Triangulate a set of vertices on the sphere. |
|
Repeat Vertices and triangles of a specific primitive function. |
|
Repeat Vertices and triangles of a specific primitive shape. |
Return vertices and triangles for a square geometry. |
|
|
Return vertices and triangle for a box geometry. |
|
Provide vertices and triangles of the spheres. |
|
Provide vertices and triangles of a superquadrics. |
Return vertices and triangles for a tetrahedron. |
|
Return vertices and triangles for icosahedron. |
|
Return vertices and triangles for rhombicuboctahedron. |
|
|
Return vertices and triangle for star geometry. |
Return vertices and triangle for a regular triangular prism. |
|
Return vertices and triangles for a pentagonal prism. |
|
Return vertices and triangle for an octagonal prism. |
|
Return vertices and triangle for a square frustum prism. |
|
|
Return vertices and triangles for a cylinder. |
|
Return vertices and triangle for arrow geometry. |
|
Return vertices and triangle of a Cone. |
faces_from_sphere_vertices#
repeat_primitive_function#
- fury.primitive.repeat_primitive_function(func, centers, *, func_args=None, directions=(1, 0, 0), colors=(1, 0, 0), scales=1)[source]#
Repeat Vertices and triangles of a specific primitive function.
It could be seen as a glyph. The primitive function should generate and return vertices and faces
- Parameters:
- funccallable
primitive functions
- centersndarray, shape (N, 3)
Superquadrics positions
- func_argsargs
primitive functions arguments/parameters
- directionsndarray, shape (N, 3) or tuple (3,), optional
The orientation vector of the cone.
- colorsndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)
RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1]
- scalesndarray, shape (N) or (N,3) or float or int, optional
The height of the cone.
- Returns:
- big_vertices: ndarray
Expanded vertices at the centers positions
- big_triangles: ndarray
Expanded triangles that composed our shape to duplicate
- big_colorsndarray
Expanded colors applied to all vertices/faces
repeat_primitive#
- fury.primitive.repeat_primitive(vertices, faces, centers, *, directions=None, colors=(1, 0, 0), scales=1, have_tiled_verts=False)[source]#
Repeat Vertices and triangles of a specific primitive shape.
It could be seen as a glyph.
- Parameters:
- vertices: ndarray
vertices coords to duplicate at the centers positions
- triangles: ndarray
triangles that composed our shape to duplicate
- centersndarray, shape (N, 3)
Superquadrics positions
- directionsndarray, shape (N, 3) or tuple (3,), optional
The orientation vector of the cone.
- colorsndarray (N,3) or (N, 4) or tuple (3,) or tuple (4,)
RGB or RGBA (for opacity) R, G, B and A should be at the range [0, 1]
- scalesndarray, shape (N) or (N,3) or float or int, optional
The height of the cone.
- have_tiled_vertsbool
option to control if we need to duplicate vertices of a shape or not
- Returns:
- big_vertices: ndarray
Expanded vertices at the centers positions
- big_triangles: ndarray
Expanded triangles that composed our shape to duplicate
- big_colorsndarray
Expanded colors applied to all vertices/faces
- big_centersndarray
Expanded centers for all vertices/faces
prim_square#
prim_box#
prim_sphere#
- fury.primitive.prim_sphere(*, name='symmetric362', gen_faces=False, phi=None, theta=None)[source]#
Provide vertices and triangles of the spheres.
- Parameters:
- namestr, optional
which sphere - one of: * ‘symmetric362’ * ‘symmetric642’ * ‘symmetric724’ * ‘repulsion724’ * ‘repulsion100’ * ‘repulsion200’
- gen_facesbool, optional
If True, triangulate a set of vertices on the sphere to get the faces. Otherwise, we load the saved faces from a file. Default: False
- phiint, optional
Set the number of points in the latitude direction
- thetaint, optional
Set the number of points in the longitude direction
- Returns:
- vertices: ndarray
vertices coords that composed our sphere
- triangles: ndarray
triangles that composed our sphere
Examples
>>> import numpy as np >>> from fury.primitive import prim_sphere >>> verts, faces = prim_sphere('symmetric362') >>> verts.shape == (362, 3) True >>> faces.shape == (720, 3) True
prim_superquadric#
- fury.primitive.prim_superquadric(roundness=(1, 1), sphere_name='symmetric362')[source]#
Provide vertices and triangles of a superquadrics.
- Parameters:
- roundnesstuple, optional
parameters (Phi and Theta) that control the shape of the superquadric
- sphere_namestr, optional
which sphere - one of: * ‘symmetric362’ * ‘symmetric642’ * ‘symmetric724’ * ‘repulsion724’ * ‘repulsion100’ * ‘repulsion200’
- Returns:
- vertices: ndarray
vertices coords that composed our sphere
- triangles: ndarray
triangles that composed our sphere
Examples
>>> import numpy as np >>> from fury.primitive import prim_superquadric >>> verts, faces = prim_superquadric(roundness=(1, 1)) >>> verts.shape == (362, 3) True >>> faces.shape == (720, 3) True
prim_tetrahedron#
prim_icosahedron#
prim_rhombicuboctahedron#
prim_star#
prim_triangularprism#
prim_pentagonalprism#
prim_octagonalprism#
prim_frustum#
prim_cylinder#
- fury.primitive.prim_cylinder(*, radius=0.5, height=1, sectors=36, capped=True)[source]#
Return vertices and triangles for a cylinder.
- Parameters:
- radius: float
Radius of the cylinder
- height: float
Height of the cylinder
- sectors: int
Sectors in the cylinder
- capped: bool
Whether the cylinder is capped at both ends or open
- Returns:
- vertices: ndarray
vertices coords that compose our cylinder
- triangles: ndarray
triangles that compose our cylinder
prim_arrow#
- fury.primitive.prim_arrow(*, height=1.0, resolution=10, tip_length=0.35, tip_radius=0.1, shaft_radius=0.03)[source]#
Return vertices and triangle for arrow geometry.
- Parameters:
- heightfloat
The height of the arrow (default: 1.0).
- resolutionint
The resolution of the arrow.
- tip_lengthfloat
The tip size of the arrow (default: 0.35)
- tip_radiusfloat
the tip radius of the arrow (default: 0.1)
- shaft_radiusfloat
The shaft radius of the arrow (default: 0.03)
- Returns:
- vertices: ndarray
vertices of the Arrow
- triangles: ndarray
Triangles of the Arrow
prim_cone#
- fury.primitive.prim_cone(*, radius=0.5, height=1, sectors=10)[source]#
Return vertices and triangle of a Cone.
- Parameters:
- radius: float, optional
Radius of the cone
- height: float, optional
Height of the cone
- sectors: int, optional
Sectors in the cone
- Returns:
- vertices: ndarray
vertices coords that compose our cone
- triangles: ndarray
triangles that compose our cone