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
def __init__(self, node, filepath, scale3d, offset, name_suffix='', generatedDir=None): r = Quaternion.to_euler(offset[3:]) * 180.0 / math.pi self.node = node.createChild('collision' + name_suffix) # node self.loader = SofaPython.Tools.meshLoader(self.node, filename=filepath, name='loader', scale3d=concat(scale3d), translation=concat( offset[:3]), rotation=concat(r), triangulate=True) self.topology = self.node.createObject('MeshTopology', name='topology', src='@loader') self.dofs = self.node.createObject('MechanicalObject', name='dofs', template='Vec3' + template_suffix) self.triangles = self.node.createObject('TriangleModel', name='model') if generatedDir is None: self.mapping = self.node.createObject('LinearMapping', template='Affine,Vec3' + template_suffix, name='mapping') else: serialization.importLinearMapping( self.node, generatedDir + "_collisionmapping.json") self.normals = None
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
def __init__(self, node, filepath, scale3d, offset, name_suffix='', generatedDir=None): r = Quaternion.to_euler(offset[3:]) * 180.0 / math.pi self.node = node.createChild('collision'+name_suffix) # node self.loader = SofaPython.Tools.meshLoader(self.node, filename=filepath, name='loader', scale3d=concat(scale3d), translation=concat(offset[:3]) , rotation=concat(r), triangulate=True) self.topology = self.node.createObject('MeshTopology', name='topology', src='@loader') self.dofs = self.node.createObject('MechanicalObject', name='dofs', template='Vec3'+template_suffix) self.triangles = self.node.createObject('TriangleModel', name='model') if generatedDir is None: self.mapping = self.node.createObject('LinearMapping', template='Affine,Vec3'+template_suffix, name='mapping') else: serialization.importLinearMapping(self.node, generatedDir+"_collisionmapping.json") self.normals = None