本文整理汇总了Python中menpo.shape.PointCloud.bounds方法的典型用法代码示例。如果您正苦于以下问题:Python PointCloud.bounds方法的具体用法?Python PointCloud.bounds怎么用?Python PointCloud.bounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menpo.shape.PointCloud
的用法示例。
在下文中一共展示了PointCloud.bounds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _parse_marker_size
# 需要导入模块: from menpo.shape import PointCloud [as 别名]
# 或者: from menpo.shape.PointCloud import bounds [as 别名]
def _parse_marker_size(marker_size, points):
if marker_size is None:
from menpo.shape import PointCloud
pc = PointCloud(points, copy=False)
# This is the way that mayavi automatically computes the scale factor in
# case the user passes scale_factor = 'auto'. We use it for both the
# marker_size as well as the numbers_size.
xyz_min, xyz_max = pc.bounds()
x_min, y_min, z_min = xyz_min
x_max, y_max, z_max = xyz_max
distance = np.sqrt(((x_max - x_min) ** 2 +
(y_max - y_min) ** 2 +
(z_max - z_min) ** 2) /
(4 * pc.n_points ** 0.33))
if distance == 0:
marker_size = 1
else:
marker_size = 0.1 * distance
return marker_size