def __init__(self, M = np.eye(4), params = None): self.children = [] self.M = M if params is not None: rot_angles = np.array(params.get('rotation', [0., 0., 0.])) translate_amount = np.array(params.get('translation', [0., 0., 0.])) scale_amount = np.array(params.get('scale', [1., 1., 1.])) # compute the transformation matrix that gets applied to all children of this node Tform = GT.translate(translate_amount) * GT.rotateX(rot_angles[0]) * \ GT.rotateY(rot_angles[1]) * GT.rotateZ(rot_angles[2]) * \ GT.scale(scale_amount) self.M = Tform.getA() self.Minv = np.linalg.inv(self.M)
def __init__(self, M=np.eye(4), params=None): self.children = [] self.M = M if params is not None: rot_angles = np.array(params.get('rotation', [0., 0., 0.])) translate_amount = np.array(params.get('translation', [0., 0., 0.])) scale_amount = np.array(params.get('scale', [1., 1., 1.])) # compute the transformation matrix that # gets applied to all children of this node Tform = GT.translate(translate_amount) * GT.rotateX(rot_angles[0]) * \ GT.rotateY(rot_angles[1]) * GT.rotateZ(rot_angles[2]) * \ GT.scale(scale_amount) self.M = Tform.getA() self.Minv = np.linalg.inv(self.M)