shapes¶
- class janim.items.three_d.shapes.ParametricSurface(uv_func: Callable[[float, float], Vect], u_range: tuple[float, float] = (0, 1), v_range: tuple[float, float] = (0, 1), **kwargs)¶
Bases:
SurfaceGeometryParametric Surface
- Parameters:
uv_func – Parametric equation; it takes
(u, v)as input and outputs the corresponding 3D coordinatesu_range – Range of values for the
uvariablev_range – Range of values for the
vvariable
Example:
ParametricSurface( lambda u, v: [np.cos(u) * np.cos(v), np.cos(u) * np.sin(v), -u], u_range=[-PI, PI], v_range=[0, TAU], resolution=16, ).into('checker')
- class janim.items.three_d.shapes.Sphere(center: Vect = array([0., 0., 0.]), radius: float = 1, u_range: tuple[float, float] = (0, 6.283185307179586), v_range: tuple[float, float] = (0, 3.141592653589793), **kwargs)¶
Bases:
SurfaceGeometry3D Sphere
- Parameters:
center – Center of the sphere
radius – Radius of the sphere
u_range – Range of the
uvariable (i.e., values around the latitude, from0toTAU)v_range – Range of the
vvariable (i.e., values along the longitude, with0at the bottom andPIat the top)
Example:
Sphere(radius=2).into('checker')
- RESOLUTIONS: dict[str, Resolution] = {'face': (24, 12), 'smooth': (101, 51)}¶
- class janim.items.three_d.shapes.Torus(major_radius: float = 3, minor_radius: float = 1, u_range: tuple[float, float] = (0, 6.283185307179586), v_range: tuple[float, float] = (0, 6.283185307179586), **kwargs)¶
Bases:
SurfaceGeometry3D Torus
- Parameters:
major_radius – Major radius (distance from the center of the torus to the center of the tube)
minor_radius – Minor radius (radius of the tube)
u_range – Range of the
uvariable (along the major direction of the torus)v_range – Range of the
vvariable (along the cross-section direction of the tube)
Example:
Torus(2.5, 0.6).into('checker')
- RESOLUTIONS: dict[str, Resolution] = {'face': 24, 'smooth': 101}¶
- class janim.items.three_d.shapes.Cylinder(radius: float = 1, height: float = 2, axis: Vect = array([0., 0., 1.]), u_range: tuple[float, float] = (0, 6.283185307179586), v_range: tuple[float, float] = (-0.5, 0.5), **kwargs)¶
Bases:
SurfaceGeometry3D Cylinder
- Parameters:
radius – Radius of the cylinder
height – Height of the cylinder
axis – Direction vector of the cylinder axis (default along
OUT)u_range – Range of the
uvariable (angle around the cylindrical surface)v_range – Range of the
vvariable (normalized values along the axis direction)
Example:
Cylinder(1, 3).into('checker')
- RESOLUTIONS: dict[str, Resolution] = {'face': (24, 12), 'smooth': (101, 11)}¶
- class janim.items.three_d.shapes.Cone(radius: float = 1, height: float = 1, axis: Vect = array([0., 0., 1.]), u_range: tuple[float, float] = (0, 6.283185307179586), v_min: float = 0, **kwargs)¶
Bases:
SurfaceGeometry3D Cone
- Parameters:
radius – Radius of the base of the cone
height – Height of the cone
axis – Direction vector of the cone axis (default along
OUT)u_range – Range of the
uvariable (angle around the conical surface)v_min – Minimum value of the
vvariable (used to crop the cone surface,0means starting from the cone tip)
Example:
Cone(1, 2).into('checker')
- RESOLUTIONS: dict[str, Resolution] = {'face': (24, 12), 'smooth': (101, 11)}¶