All Downloads are FREE. Search and download functionalities are using the official Maven repository.

us.ihmc.simulationconstructionset.graphics.joints.GraphicsJoint Maven / Gradle / Ivy

There is a newer version: 0.25.2
Show newest version
package us.ihmc.simulationconstructionset.graphics.joints;

import us.ihmc.euclid.exceptions.NotARotationMatrixException;
import us.ihmc.euclid.transform.RigidBodyTransform;
import us.ihmc.graphicsDescription.Graphics3DObject;
import us.ihmc.graphicsDescription.structure.Graphics3DNode;
import us.ihmc.graphicsDescription.structure.Graphics3DNodeType;
import us.ihmc.simulationconstructionset.util.CommonJoint;

public class GraphicsJoint extends Graphics3DNode
{
   private final CommonJoint joint;

   public GraphicsJoint(String name, CommonJoint joint, Graphics3DObject graphics3DObject, Graphics3DNodeType nodeType)
   {
      super(name, nodeType);
      this.joint = joint;

      setGraphicsObject(graphics3DObject);

   }

   public final void updateFromJoint()
   {
      try
      {
         RigidBodyTransform transformToParent = new RigidBodyTransform();
         transformToParent.set(joint.getOffsetTransform3D());
         transformToParent.multiply(joint.getJointTransform3D());
         setTransform(transformToParent);
      }
      catch (NotARotationMatrixException e)
      {
         e.printStackTrace();
      }
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy