本文整理汇总了Python中Matrix.project_to_axis方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.project_to_axis方法的具体用法?Python Matrix.project_to_axis怎么用?Python Matrix.project_to_axis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix
的用法示例。
在下文中一共展示了Matrix.project_to_axis方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_axis
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import project_to_axis [as 别名]
def show_axis(tf, color, os):
import Matrix
axis, axis_point, angle, axis_shift = Matrix.axis_center_angle_shift(tf)
if angle < 0.1:
raise CommandError, 'Rotation angle is near zero (%g degrees)' % angle
have_box, box = os.bbox()
if not have_box:
# TODO: Chimera does not provide bounding box of full model.
raise CommandError, 'First model must be visible to show axis'
axis_center = Matrix.project_to_axis(box.center().data(), axis, axis_point)
axis_length = max((box.urb - box.llf).data())
hl = 0.5*axis_length
ap1 = map(lambda a,b: a-hl*b, axis_center, axis)
ap2 = map(lambda a,b: a+hl*b, axis_center, axis)
from VolumePath import Marker_Set, Link
from VolumePath.markerset import chimera_color
m = Marker_Set('rotation axis')
mm = m.marker_model()
mm.openState.xform = os.xform
if color:
mm.color = chimera_color(color)
radius = 0.025 * axis_length
m1 = m.place_marker(ap1, None, radius)
m2 = m.place_marker(ap2, None, radius)
Link(m1, m2, None, radius)