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)¶
-
参数曲面
- 参数:
uv_func -- 参数方程,输入
(u, v),输出对应的三维坐标u_range --
u变量的取值范围v_range --
v变量的取值范围
示例:
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)¶
-
三维球体
- 参数:
center -- 球体中心
radius -- 球体半径
u_range --
u变量的范围(即绕纬线的取值,从0到TAU)v_range --
v变量的范围(即沿经线的取值,最底端为0,最顶端为PI)
示例:
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)¶
-
三维圆环面
- 参数:
major_radius -- 主半径(圆环中心到管道中心的距离)
minor_radius -- 次半径(管道半径)
u_range --
u变量的范围(沿圆环主方向)v_range --
v变量的范围(沿管道截面方向)
示例:
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)¶
-
三维圆柱面
- 参数:
radius -- 圆柱半径
height -- 圆柱高度
axis -- 圆柱轴线方向向量(默认沿
OUT)u_range --
u变量的范围(绕圆柱侧面的角度)v_range --
v变量的范围(沿轴线方向的归一化取值)
示例:
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)¶
-
三维圆锥面
- 参数:
radius -- 圆锥底面半径
height -- 圆锥高度
axis -- 圆锥轴线方向向量(默认沿
OUT)u_range --
u变量的范围(绕圆锥侧面的角度)v_min --
v变量的最小值(用于裁剪锥面,0表示从锥尖开始)
示例:
Cone(1, 2).into('checker')
- RESOLUTIONS: dict[str, Resolution] = {'face': (24, 12), 'smooth': (101, 11)}¶