maliang.three.engine¶
 字数 9 个 阅读时间不到 1 分钟 访问量
Core codes of 3D
类:
-  
Canvas–Base class of 3D Canvas
 -  
Space–A canvas where you can view 3D objects
 -  
Component–3D 对象基类
 -  
Point–点
 -  
Line–线
 -  
Plane–面
 -  
Text3D–三维文本
 -  
Geometry–几何体
 
函数:
-  
translate–将一个三维空间中的点进行平移
 -  
rotate–将一个三维空间中的点以一个点或线为参照进行旋转(实现方式为欧拉角)
 -  
scale–将一个三维空间中的点以另一个点为缩放中心进行缩放
 -  
project–将一个三维空间中的点投影到指定距离的正向平面上,并返回在该平面上的坐标
 
  Canvas ¶
 Canvas(
    master: containers.Tk | containers.Toplevel | containers.Canvas | None = None,
    *,
    expand: typing.Literal["", "x", "y", "xy"] = "xy",
    auto_zoom: bool = False,
    keep_ratio: typing.Literal["min", "max"] | None = None,
    free_anchor: bool = False,
    **kwargs
)
 Bases: containers.Canvas
Base class of 3D Canvas
方法:
-  
space_sort–Sort the contextual relationship between the spatial positions of the components
 
属性:
-  
components(tuple[Component, ...]) –Return all
Componentof this Canvas -  
geometries(tuple[Geometry, ...]) –Return all
Geometryof this Canvas 
  Space ¶
 Space(
    master: containers.Tk | containers.Toplevel | containers.Canvas | None = None,
    *,
    expand: typing.Literal["", "x", "y", "xy"] = "xy",
    auto_zoom: bool = False,
    keep_ratio: typing.Literal["min", "max"] | None = None,
    free_anchor: bool = False,
    **kwargs
)
  Component ¶
     Point ¶
     Line ¶
     Plane ¶
     Text3D ¶
     Geometry ¶
  几何体
canvas: 父画布sides: 组成几何体的面
方法:
  translate ¶
 translate(
    coordinate: tuple[float, float, float], dx: float = 0, dy: float = 0, dz: float = 0
) -> None
将一个三维空间中的点进行平移
coordinate: 点的空间坐标dx: x 方向位移长度dy: y 方向位移长度dz: z 方向位移长度
  rotate ¶
   将一个三维空间中的点以一个点或线为参照进行旋转(实现方式为欧拉角)
coordinate: 点的空间坐标dx: x 方向逆时针旋转弧度,或者绕旋转轴线的旋转弧度dy: y 方向逆时针旋转弧度dz: z 方向逆时针旋转弧度center: 旋转中心的空间坐标axis: 旋转轴线的空间坐标
  scale ¶
  将一个三维空间中的点以另一个点为缩放中心进行缩放
coordinate: 点的空间坐标kx: x 方向缩放比例ky: y 方向缩放比例kz: z 方向缩放比例center: 缩放中心的空间坐标
  project ¶
  将一个三维空间中的点投影到指定距离的正向平面上,并返回在该平面上的坐标
coordinate: 点的空间坐标distance: 正向平面的距离(平面正对着我们)