java.lang.Object
com.marginallyclever.ro3.node.Node
com.marginallyclever.ro3.node.nodes.pose.Pose
All Implemented Interfaces:
PoseChangeListener, EventListener
Direct Known Subclasses:
AttachmentPoint, Camera, CelestialBody, Limb, LookAt, MeshInstance, ODENode, SpaceShip

public class Pose extends Node implements PoseChangeListener

A Pose is a Node that has a position and rotation in space.

  • Constructor Details

    • Pose

      public Pose()
    • Pose

      public Pose(String name)
  • Method Details

    • addPoseChangeListener

      public void addPoseChangeListener(PoseChangeListener listener)
    • removePoseChangeListener

      public void removePoseChangeListener(PoseChangeListener listener)
    • getComponents

      public void getComponents(List<JPanel> list)
      Build a Swing Component that represents this Node.
      Overrides:
      getComponents in class Node
      Parameters:
      list - the list to add components to.
    • getLocal

      public javax.vecmath.Matrix4d getLocal()
    • setLocal

      public void setLocal(javax.vecmath.Matrix4d m)
      Set the local transform of this pose. This is the best method to override if you want to capture changes to the local OR world transform.
      Parameters:
      m - the new local transform.
    • getWorld

      public javax.vecmath.Matrix4d getWorld()
      Returns:
      the world transform of this pose.
    • setWorld

      public void setWorld(javax.vecmath.Matrix4d m)
      Set the world transform of this pose. All cases call setLocal(Matrix4d).
      Parameters:
      m - the new world transform.
    • getRotationEuler

      public javax.vecmath.Vector3d getRotationEuler(MatrixHelper.EulerSequence orderOfRotation)
      Parameters:
      orderOfRotation - the order of rotation.
      Returns:
      the local rotation of this pose using Euler angles in degrees.
    • setRotationEuler

      public void setRotationEuler(javax.vecmath.Vector3d r, MatrixHelper.EulerSequence orderOfRotation)
      Set the local rotation of this pose using Euler angles.
      Parameters:
      r - Euler angles in degrees.
      orderOfRotation - the order of rotation.
    • getPosition

      public javax.vecmath.Vector3d getPosition()
      Returns:
      the local position of this pose.
    • setPosition

      public void setPosition(javax.vecmath.Vector3d p)
      Set the local position of this pose.
      Parameters:
      p - the new position.
    • toJSON

      public org.json.JSONObject toJSON()
      Description copied from class: Node
      Serialize this node and its children to a JSON object and its children. Classes that override this method should call super.toJSON() first, then add to the object returned.
      Overrides:
      toJSON in class Node
      Returns:
      the JSON object.
    • fromJSON

      public void fromJSON(org.json.JSONObject from)
      Description copied from class: Node
      Deserialize this node and its children from a JSON object and its children. Classes that override this method should call super.fromJSON(). When they do it will trigger the creation of child nodes. The child nodes will then call their own fromJSON() methods.
      Overrides:
      fromJSON in class Node
      Parameters:
      from - the JSON object to read from.
    • getRotationIndex

      public MatrixHelper.EulerSequence getRotationIndex()
    • setRotationIndex

      public void setRotationIndex(MatrixHelper.EulerSequence rotationIndex)
    • getIcon

      public Icon getIcon()
      Description copied from class: Node
      Set a custom icon for this node.
      Overrides:
      getIcon in class Node
      Returns:
      the icon, or null if none.
    • getParentPose

      public Pose getParentPose()
    • onPoseChange

      public void onPoseChange(Pose pose)
      Override this method to receive pose change events from the parent.
      Specified by:
      onPoseChange in interface PoseChangeListener
      Parameters:
      pose - the parent pose that has changed.