Open3D中的open3d.geometry.HalfEdgeTriangleMesh
类提供了缩放网格的功能。
def scale(self, scale: float, center: Optional[np.ndarray] = None) -> None:
"""
Scales this mesh by a given factor around
a given center point.
:param scale: float, The scaling factor.
:param center: numpy array (3,), The center point.
"""
scale
:float类型,缩放因子,表示将网格沿各个轴方向的长度缩放到原来的scale
倍。center
:numpy数组类型,形状为(3,)
,表示缩放的中心点。import open3d as o3d
import numpy as np
mesh = o3d.geometry.TriangleMesh.create_box()
mesh.scale(2.0, np.array([0,0,0]))
以上代码将创建一个边长为1的立方体网格,然后将其按照给定的中心点(0,0,0)
以2.0
的缩放因子进行缩放。缩放后的网格边长为2。
center
参数为None时,则整个网格的几何中心点将被视为缩放中心。