Class Plane3D

java.lang.Object
org.jlab.geom.prim.Plane3D
All Implemented Interfaces:
Transformable, Showable

public final class Plane3D extends Object implements Transformable, Showable
An infinite unbounded 3D plane represented by a vector that is normal to the plane and a reference point on the plane.

Plane3D contains intersection finding functions for infinite lines, rays, line segments, one other plane, and two other planes.

Author:
gavalian
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Constructs a new Plane3D such that the reference point is at the origin and the normal vector is a null vector.
    Plane3D(double px, double py, double pz, double nx, double ny, double nz)
    Constructs a new Plane3D such that the new plane passes through the point specified by the first the given values and the normal of the new plane is parallel to the the vector specified by the last three given values.
    Constructs a new Plane3D that is equivalent to the given plane.
    Plane3D(Point3D point, Vector3D normal)
    Constructs a new Plane3D such that the new plane passes through the given point and the normal of the new plane is parallel to the given vector.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    void
    copy(Plane3D plane)
    Sets the reference point and normal of this plane to coincide with the reference point and normal of the given plane.
    void
    distance(Point3D p, Line3D distance)
    Calculates a Line3D object with origin at the given point and the end at the plane, length is the distance to the plane.
    int
    intersection(Line3D line, Point3D intersect)
    Finds the intersection of the given infinite with this plane.
    int
    intersection(Plane3D plane, Line3D intersect)
    Finds the intersection of the given plane with this plane.
    boolean
    intersection(Plane3D plane1, Plane3D plane2, Point3D intersect)
    Finds the intersection of the two given planes and this plane.
    int
    intersectionRay(Line3D line, Point3D intersect)
    Finds the intersection of the given ray with this plane.
    int
    Finds the intersection of the given line segment with this plane.
    Returns the normal of this plane.
    Returns the reference point of this plane.
    void
    rotateX(double angle)
    Rotates this object clockwise around the x axis.
    void
    rotateY(double angle)
    Rotates this object clockwise around the y axis.
    void
    rotateZ(double angle)
    Rotates this object clockwise around the z axis.
    void
    set(double px, double py, double pz, double nx, double ny, double nz)
    Sets the coordinates of the reference point and components of the normal vector of this plane using the given values.
    void
    set(Point3D point, Vector3D normal)
    Sets the reference point and normal of this plane to coincide with the given point and vector.
    void
    setNormal(double nx, double ny, double nz)
    Sets the components of the normal vector of this plane.
    void
    Sets the normal of this plane to parallel the given vector.
    void
    setPoint(double px, double py, double pz)
    Sets the coordinates of the reference point of this plane.
    void
    Sets the reference point of this plane.
    void
    Invokes System.out.println(this).
     
    void
    translateXYZ(double x, double y, double z)
    Translates this object linearly by the amounts specified.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details Link icon

    • Plane3D Link icon

      public Plane3D()
      Constructs a new Plane3D such that the reference point is at the origin and the normal vector is a null vector.
    • Plane3D Link icon

      public Plane3D(Point3D point, Vector3D normal)
      Constructs a new Plane3D such that the new plane passes through the given point and the normal of the new plane is parallel to the given vector.
      Parameters:
      point - the reference point
      normal - the normal of the surface of the plane
    • Plane3D Link icon

      public Plane3D(double px, double py, double pz, double nx, double ny, double nz)
      Constructs a new Plane3D such that the new plane passes through the point specified by the first the given values and the normal of the new plane is parallel to the the vector specified by the last three given values.
      Parameters:
      px - the x coordinate of the point
      py - the y coordinate of the point
      pz - the z coordinate of the point
      nx - the x component of the normal
      ny - the y component of the normal
      nz - the z component of the normal
    • Plane3D Link icon

      public Plane3D(Plane3D plane)
      Constructs a new Plane3D that is equivalent to the given plane.
      Parameters:
      plane - the plane to copy
  • Method Details Link icon

    • copy Link icon

      public void copy(Plane3D plane)
      Sets the reference point and normal of this plane to coincide with the reference point and normal of the given plane.
      Parameters:
      plane - the line to copy
    • set Link icon

      public void set(Point3D point, Vector3D normal)
      Sets the reference point and normal of this plane to coincide with the given point and vector.
      Parameters:
      point - the reference point
      normal - the normal
    • setNormal Link icon

      public void setNormal(Vector3D normal)
      Sets the normal of this plane to parallel the given vector.
      Parameters:
      normal - the normal
    • setPoint Link icon

      public void setPoint(Point3D point)
      Sets the reference point of this plane.
      Parameters:
      point - the reference point
    • set Link icon

      public void set(double px, double py, double pz, double nx, double ny, double nz)
      Sets the coordinates of the reference point and components of the normal vector of this plane using the given values.
      Parameters:
      px - the x coordinate of the point
      py - the y coordinate of the point
      pz - the z coordinate of the point
      nx - the x component of the normal
      ny - the y component of the normal
      nz - the z component of the normal
    • setPoint Link icon

      public void setPoint(double px, double py, double pz)
      Sets the coordinates of the reference point of this plane.
      Parameters:
      px - the x coordinate of the point
      py - the y coordinate of the point
      pz - the z coordinate of the point
    • setNormal Link icon

      public void setNormal(double nx, double ny, double nz)
      Sets the components of the normal vector of this plane.
      Parameters:
      nx - the x component of the normal
      ny - the y component of the normal
      nz - the z component of the normal
    • point Link icon

      public Point3D point()
      Returns the reference point of this plane.
      Returns:
      a point on this plane
    • normal Link icon

      public Vector3D normal()
      Returns the normal of this plane.
      Returns:
      the normal of this plane
    • distance Link icon

      public void distance(Point3D p, Line3D distance)
      Calculates a Line3D object with origin at the given point and the end at the plane, length is the distance to the plane.
      Parameters:
      p - point in space
      distance - line with end point on the plane
    • intersection Link icon

      public int intersection(Line3D line, Point3D intersect)
      Finds the intersection of the given infinite with this plane. If an intersection point is found it will be stored in the given point. Return codes: 0 = disjoint, 1 = intersecting, 2 = coinciding.
      Parameters:
      line - the infinite line
      intersect - the intersection point
      Returns:
      0 = disjoint, 1 = intersecting, 2 = coinciding
    • intersectionRay Link icon

      public int intersectionRay(Line3D line, Point3D intersect)
      Finds the intersection of the given ray with this plane. If an intersection point is found it will be stored in the given point. Return codes: 0 = disjoint, 1 = intersecting, 2 = coinciding.
      Parameters:
      line - the ray segment
      intersect - the intersection point
      Returns:
      0 = disjoint, 1 = intersecting, 2 = coinciding
    • intersectionSegment Link icon

      public int intersectionSegment(Line3D line, Point3D intersect)
      Finds the intersection of the given line segment with this plane. If an intersection point is found it will be stored in the given point. Return codes: 0 = disjoint, 1 = intersecting, 2 = coinciding.
      Parameters:
      line - the line segment
      intersect - the intersection point
      Returns:
      0 = disjoint, 1 = intersecting, 2 = coinciding
    • intersection Link icon

      public int intersection(Plane3D plane, Line3D intersect)
      Finds the intersection of the given plane with this plane. If an intersection line is found it will be stored in the given line. Return codes: 0 = disjoint, 1 = intersecting, 2 = coinciding.
      Parameters:
      plane - the line
      intersect - the intersection line
      Returns:
      0 = disjoint, 1 = intersecting, 2 = coinciding
    • intersection Link icon

      public boolean intersection(Plane3D plane1, Plane3D plane2, Point3D intersect)
      Finds the intersection of the two given planes and this plane. If an intersection point is found it will be stored in the given point. Returns true if an intersection was found.
      Parameters:
      plane1 - the first plane
      plane2 - the second plane
      intersect - the intersection point
      Returns:
      true if the intersection was found
    • translateXYZ Link icon

      public void translateXYZ(double x, double y, double z)
      Description copied from interface: Transformable
      Translates this object linearly by the amounts specified.
      Specified by:
      translateXYZ in interface Transformable
      Parameters:
      x - amount to translate along the x axis
      y - amount to translate along the y axis
      z - amount to translate along the z axis
    • rotateX Link icon

      public void rotateX(double angle)
      Description copied from interface: Transformable
      Rotates this object clockwise around the x axis.
      Specified by:
      rotateX in interface Transformable
      Parameters:
      angle - rotation angle in radians
    • rotateY Link icon

      public void rotateY(double angle)
      Description copied from interface: Transformable
      Rotates this object clockwise around the y axis.
      Specified by:
      rotateY in interface Transformable
      Parameters:
      angle - rotation angle in radians
    • rotateZ Link icon

      public void rotateZ(double angle)
      Description copied from interface: Transformable
      Rotates this object clockwise around the z axis.
      Specified by:
      rotateZ in interface Transformable
      Parameters:
      angle - rotation angle in radians
    • show Link icon

      public void show()
      Invokes System.out.println(this).
      Specified by:
      show in interface Showable
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object