Record Class AxisPlane

java.lang.Object
java.lang.Record
com.j3d.engine.math.plane.AxisPlane
Record Components:
origin - The point on the plane
v1 - The first orthogonal vector
v2 - The second orthogonal vector

public record AxisPlane(Vector3 origin, Vector3 v1, Vector3 v2) extends Record
A plane defined by an origin point and two orthogonal vectors (v1 and v2) that lie within the plane. These vectors define the local coordinate system of the plane.
Author:
Lehlogonolo Poole
  • Field Details

    • origin

      private final Vector3 origin
      The field for the origin record component.
    • v1

      private final Vector3 v1
      The field for the v1 record component.
    • v2

      private final Vector3 v2
      The field for the v2 record component.
  • Constructor Details

    • AxisPlane

      public AxisPlane(Vector3 origin, Vector3 v1, Vector3 v2)
      Creates an instance of a AxisPlane record class.
      Parameters:
      origin - the value for the origin record component
      v1 - the value for the v1 record component
      v2 - the value for the v2 record component
  • Method Details

    • usingOrigin

      public static AxisPlane usingOrigin(Vector3 origin, AxisPlane original)
    • toWorld

      public Vector3 toWorld(CartesianPoint point)
    • fromWorld

      public CartesianPoint fromWorld(Vector3 point)
    • normalize

      public AxisPlane normalize()
      Normalises the vectors
      Returns:
      A new plane with the normalised vectors
    • toNormalPlane

      public NormalPlane toNormalPlane()
      Converts this AxisPlane to a NormalPlane.
      Returns:
      A new NormalPlane with the same origin and a normal derived from this AxisPlane.
    • pair

      public SamePair<AxisPlane> pair()
      Returns a SamePair containing two references to this plane.
      Returns:
      A SamePair of this plane.
    • sameAxes

      public SamePair<AxisPlane> sameAxes(Vector3 origin1, Vector3 origin2)
      Returns a SamePair containing two new AxisPlane instances, each with a different origin.
      Parameters:
      origin1 - The origin for the first AxisPlane.
      origin2 - The origin for the second AxisPlane.
      Returns:
      A SamePair of AxisPlane instances with the specified origins.
    • sameAxes

      public static SamePair<AxisPlane> sameAxes(Vector3 v1, Vector3 v2, Vector3 originA, Vector3 originB)
      Creates a SamePair of AxisPlane instances with the same basis vectors but different origins.
      Parameters:
      v1 - The first orthogonal vector for both planes.
      v2 - The second orthogonal vector for both planes.
      originA - The origin for the first AxisPlane.
      originB - The origin for the second AxisPlane.
      Returns:
      A SamePair of AxisPlane instances.
    • XZ

      public static AxisPlane XZ(Vector3 origin)
      Returns a plane representing the XZ-plane.
      Parameters:
      origin - The origin of the plane.
      Returns:
      The XZ-plane.
    • XY

      public static AxisPlane XY(Vector3 origin)
      Returns a plane representing the XY-plane.
      Parameters:
      origin - The origin of the plane.
      Returns:
      The XY-plane.
    • ZY

      public static AxisPlane ZY(Vector3 origin)
      Returns a plane representing the ZY-plane.
      Parameters:
      origin - The origin of the plane.
      Returns:
      The ZY-plane.
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • origin

      public Vector3 origin()
      Returns the value of the origin record component.
      Returns:
      the value of the origin record component
    • v1

      public Vector3 v1()
      Returns the value of the v1 record component.
      Returns:
      the value of the v1 record component
    • v2

      public Vector3 v2()
      Returns the value of the v2 record component.
      Returns:
      the value of the v2 record component