本文整理汇总了Python中Matrix.xform_matrix方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.xform_matrix方法的具体用法?Python Matrix.xform_matrix怎么用?Python Matrix.xform_matrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix
的用法示例。
在下文中一共展示了Matrix.xform_matrix方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rotation_axis
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import xform_matrix [as 别名]
def rotation_axis(operation, model1, model2,
showAxis = True, showSlabs = False, color = None):
os1 = set([m.openState for m in model1])
os2 = set([m.openState for m in model2])
if len(os1) != 1:
raise CommandError, 'First model spec names %d models, require 1' % len(os1)
if len(os2) != 1:
raise CommandError, 'Second model spec names %d models, require 1' % len(os2)
os1 = os1.pop()
os2 = os2.pop()
xf = os1.xform.inverse()
xf.multiply(os2.xform)
import Matrix
tf = Matrix.xform_matrix(xf)
message = ('Position of %s (%s) relative to %s (%s) coordinates:\n'
% (model2[0].name, model2[0].oslIdent(),
model1[0].name, model1[0].oslIdent()))
message += Matrix.transformation_description(tf)
from chimera import replyobj
replyobj.info(message)
from chimera import MaterialColor
if isinstance(color, MaterialColor):
color = color.rgba()
elif not color is None:
raise CommandError, 'Unknown color "%s"' % str(color)
if showAxis:
show_axis(tf, color, os1)
if showSlabs:
show_slabs(xf, color, os1)
示例2: transform_ellipsoid
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import xform_matrix [as 别名]
def transform_ellipsoid(axes, center, xform):
import Matrix as m
tf = m.xform_matrix(xform)
axes = m.apply_matrix_without_translation(tf, axes)
center = m.apply_matrix(tf, center)
return axes, center
示例3: show_cumulative_transform
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import xform_matrix [as 别名]
def show_cumulative_transform(self, m):
from chimera import Xform
mxf = getattr(m, 'applied_xform', Xform())
import Matrix
tf = Matrix.xform_matrix(mxf)
angles = Matrix.euler_angles(tf)
shift = mxf.getTranslation().data()
text = ('Cumulative:\n' +
' Euler angles %.5g %.5g %.5g\n' % angles +
' Shift: %.5g %.5g %.5g' % shift)
self.cumulative['text'] = text
示例4: print_axes
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import xform_matrix [as 别名]
def print_axes(axes, d2, elen, name, xform = None):
if xform:
import Matrix as m
axes = m.apply_matrix_without_translation(m.xform_matrix(xform), axes)
from math import sqrt
paxes = ['\tv%d = %6.3f %6.3f %6.3f %s = %6.3f r%d = %6.3f' %
(a+1, axes[a][0], axes[a][1], axes[a][2],
('a','b','c')[a], elen[a], a+1, sqrt(d2[a]))
for a in range(3)]
from chimera.replyobj import info
info('Inertia axes for %s\n%s\n' % (name, '\n'.join(paxes)))
from Accelerators.standard_accelerators import show_reply_log
show_reply_log()
示例5: texture_surface_piece
# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import xform_matrix [as 别名]
def texture_surface_piece(p, t, txf, border_color, offset = 0):
p.textureId = t.texture_id()
p.useTextureTransparency = ('a' in t.color_mode)
p.textureModulationColor = t.modulation_rgba()
p.textureBorderColor = border_color
va = offset_vertices(p, offset)
s2tc = t.texture_matrix()
p2s = p.model.openState.xform
p2s.premultiply(txf.inverse())
import Matrix
p2tc = Matrix.multiply_matrices(s2tc, Matrix.xform_matrix(p2s))
import _contour
_contour.affine_transform_vertices(va, p2tc)
p.textureCoordinates = va
p.using_surface_coloring = True