本文整理匯總了Python中SofaPython.Quaternion.to_euler方法的典型用法代碼示例。如果您正苦於以下問題:Python Quaternion.to_euler方法的具體用法?Python Quaternion.to_euler怎麽用?Python Quaternion.to_euler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SofaPython.Quaternion
的用法示例。
在下文中一共展示了Quaternion.to_euler方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from SofaPython import Quaternion [as 別名]
# 或者: from SofaPython.Quaternion import to_euler [as 別名]
def __init__(self, node, filepath, scale3d, offset):
self.node = node.createChild( "collision" ) # node
r = Quaternion.to_euler(offset[3:]) * 180.0 / math.pi
self.loader = self.node.createObject("MeshObjLoader", name='loader', filename=filepath, scale3d=concat(scale3d), translation=concat(offset[:3]), rotation=concat(r), triangulate=1 )
self.topology = self.node.createObject('MeshTopology', name='topology', src="@loader" )
self.dofs = self.node.createObject('MechanicalObject', name='dofs')
self.triangles = self.node.createObject('TriangleModel', template='Vec3d', name='model')
self.mapping = self.node.createObject('RigidMapping', name="mapping")
示例2: __init__
# 需要導入模塊: from SofaPython import Quaternion [as 別名]
# 或者: from SofaPython.Quaternion import to_euler [as 別名]
def __init__(self, node, filepath, scale3d, offset, name_suffix=''):
global idxVisualModel
self.node = node.createChild( "visual"+name_suffix ) # node
r = Quaternion.to_euler(offset[3:]) * 180.0 / math.pi
self.model = self.node.createObject('VisualModel', name="visual"+str(idxVisualModel), fileMesh=filepath,
scale3d=concat(scale3d), translation=concat(offset[:3]) , rotation=concat(r),
useNormals=False, updateNormals=True)
self.mapping = self.node.createObject('RigidMapping', name="mapping")
idxVisualModel+=1
示例3: __init__
# 需要導入模塊: from SofaPython import Quaternion [as 別名]
# 或者: from SofaPython.Quaternion import to_euler [as 別名]
def __init__(self, node, filepath, scale3d, offset, name_suffix='', generatedDir=None):
r = Quaternion.to_euler(offset[3:]) * 180.0 / math.pi
global idxVisualModel;
self.node = node.createChild('visual'+name_suffix) # node
self.model = self.node.createObject('VisualModel', name='visual'+str(idxVisualModel), fileMesh=filepath, scale3d=concat(scale3d), translation=concat(offset[:3]), rotation=concat(r))
if generatedDir is None:
self.mapping = self.node.createObject('LinearMapping', template='Affine,ExtVec3f', name='mapping')
else:
serialization.importLinearMapping(self.node, generatedDir+"_visualmapping.json")
idxVisualModel+=1
示例4: loadVisualCylinder
# 需要導入模塊: from SofaPython import Quaternion [as 別名]
# 或者: from SofaPython.Quaternion import to_euler [as 別名]
def loadVisualCylinder(self, meshPath, offset = [0,0,0,0,0,0,1], scale=[1,1,1], color=[1,1,1,1],radius=0.01,**kwargs):
r = Quaternion.to_euler(offset[3:]) * 180.0 / math.pi
self.visual = self.node.createObject("OglCylinderModel", radius=radius, position="@topology.position", edges="@topology.edges" )
self.normals = self.visual
示例5: loadVisual
# 需要導入模塊: from SofaPython import Quaternion [as 別名]
# 或者: from SofaPython.Quaternion import to_euler [as 別名]
def loadVisual(self, meshPath, offset = [0,0,0,0,0,0,1], scale=[1,1,1], color=[1,1,1,1],**kwargs):
r = Quaternion.to_euler(offset[3:]) * 180.0 / math.pi
self.visual = self.node.createObject("VisualModel", name="model", filename=meshPath, translation=concat(offset[:3]) , rotation=concat(r), scale3d=concat(scale), color=concat(color), putOnlyTexCoords=True,computeTangents=True,**kwargs)
# self.visual = self.node.createObject("VisualModel", name="model", filename=meshPath, translation=concat(offset[:3]) , rotation=concat(r), scale3d=concat(scale), color=concat(color), **kwargs)
self.visual.setColor(color[0],color[1],color[2],color[3]) # the previous assignement fails when reloading a scene..
self.normals = self.visual
示例6: loadMesh
# 需要導入模塊: from SofaPython import Quaternion [as 別名]
# 或者: from SofaPython.Quaternion import to_euler [as 別名]
def loadMesh(self, meshPath, offset = [0,0,0,0,0,0,1], scale=[1,1,1], triangulate=False):
r = Quaternion.to_euler(offset[3:]) * 180.0 / math.pi
self.meshLoader = SofaPython.Tools.meshLoader(self.node, meshPath, translation=concat(offset[:3]) , rotation=concat(r), scale3d=concat(scale), triangulate=triangulate)
self.topology = self.node.createObject("MeshTopology", name="topology", src="@"+self.meshLoader.name )
示例7: transformToData
# 需要導入模塊: from SofaPython import Quaternion [as 別名]
# 或者: from SofaPython.Quaternion import to_euler [as 別名]
def transformToData(scale,offset,timeOffset=0,timeScale=1,isPerspective=0):
""" Returns a transform, formatted to sofa data given voxelsize, rigid position (offset), time and camera parameters
"""
return concat(offset[:3])+' '+concat(quat.to_euler(offset[3:])*180./math.pi)+' '+concat(scale)+' '+str(timeOffset)+' '+str(timeScale)+' '+str(int(isPerspective))