Class Transform

java.lang.Object
net.apartium.cocoabeans.space.Transform

@AvailableSince("0.0.30") public class Transform extends Object
Represents a transform in 3D space, combining position and rotation
See Also:
  • Constructor Details

    • Transform

      public Transform(double x, double y, double z, float yaw, float pitch)
      Create a new transform
      Parameters:
      x - x
      y - y
      z - z
      yaw - yaw
      pitch - pitch
    • Transform

      public Transform(Position position, Rotation rotation)
      Create a new transform
      Parameters:
      position - position
      rotation - rotation
    • Transform

      public Transform(Transform other)
      Create a new transform from another one
      Parameters:
      other - source
  • Method Details

    • getX

      public double getX()
      Returns the x coordinate
      Returns:
      x
    • setX

      public Transform setX(double x)
      Sets the x coordinate
      Parameters:
      x - new x
      Returns:
      this
    • getY

      public double getY()
      Returns the y coordinate
      Returns:
      y
    • setY

      public Transform setY(double y)
      Sets the y coordinate
      Parameters:
      y - new y
      Returns:
      this
    • getZ

      public double getZ()
      Returns the z coordinate
      Returns:
      z
    • setZ

      public Transform setZ(double z)
      Sets the z coordinate
      Parameters:
      z - new z
      Returns:
      this
    • getYaw

      public float getYaw()
      Returns the yaw
      Returns:
      yaw
    • setYaw

      public Transform setYaw(float yaw)
      Sets the yaw
      Parameters:
      yaw - new yaw
      Returns:
      this
    • getPitch

      public float getPitch()
      Returns the pitch
      Returns:
      pitch
    • setPitch

      public Transform setPitch(float pitch)
      Sets the pitch
      Parameters:
      pitch - new pitch
      Returns:
      this
    • getPosition

      public Position getPosition()
      Returns the position Changes on the returned object will be reflected in this one
      Returns:
      position
    • setPosition

      public Transform setPosition(Position position)
      Sets the position
      Parameters:
      position - new position
      Returns:
      this
    • getRotation

      public Rotation getRotation()
      Returns the rotation Changes on the returned object will be reflected in this one
      Returns:
      rotation
    • setRotation

      public Transform setRotation(Rotation rotation)
      Sets the rotation
      Parameters:
      rotation - new rotation
      Returns:
      this
    • translate

      public Transform translate(Position translation)
      Translate the transform by a given position
      Parameters:
      translation - position to translate by
      Returns:
      this
    • rotate

      public Transform rotate(Rotation deltaRotation)
      Rotate the transform by a given rotation
      Parameters:
      deltaRotation - rotation to rotate by
      Returns:
      this
    • getDirectionVector

      public Position getDirectionVector()
      Create a direction vector based on the current rotation
      Returns:
      direction vector
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object