本文整理汇总了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))