Package geometries

Class Plane

java.lang.Object
geometries.Geometry
geometries.Plane
All Implemented Interfaces:
Intersectible

public class Plane
extends Geometry
A Plane is a flat two dimensional surface in three dimensional space which goes off to infinity in all directions.
  • Field Summary

    Fields
    Modifier and Type Field Description
    NormalizedVector normal
    The normal vector of the plane.
    Point point
    A point on the plane.

    Fields inherited from class geometries.Geometry

    material
  • Constructor Summary

    Constructors
    Constructor Description
    Plane​(Material material, Point point, NormalizedVector normal)
    This constructor accepts a point on the plane and a vector perpendicular to the plane.
    Plane​(Material material, Point p1, Point p2, Point p3)
    This constructor accepts three distinct points on the plane.
  • Method Summary

    Modifier and Type Method Description
    geometries.Boundary boundary()
    Get the Boundary of this intersectible.
    java.util.List<Intersection> intersect​(LineSegment line)
    Calculates all the intersections between a given LineSegment and this object.
    NormalizedVector normal​(Point p)
    Calculates the normal to the Geometry at the given Point.

    Methods inherited from class geometries.Geometry

    intersection

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • point

      public final Point point
      A point on the plane.
    • normal

      public final NormalizedVector normal
      The normal vector of the plane.
  • Constructor Details

    • Plane

      public Plane​(Material material, Point point, NormalizedVector normal)
      This constructor accepts a point on the plane and a vector perpendicular to the plane.
      Parameters:
      material - The Material the plane is made from.
      point - A point on the plane.
      normal - A normalized vector perpendicular to the plane.
    • Plane

      public Plane​(Material material, Point p1, Point p2, Point p3)
      This constructor accepts three distinct points on the plane.
      Parameters:
      material - The Material the plane is made from.
      p1 - A point on the plane.
      p2 - A point on the plane.
      p3 - A point on the plane.
      Throws:
      java.lang.IllegalArgumentException - if the three points are on a single line.
  • Method Details

    • normal

      public NormalizedVector normal​(Point p)
      Description copied from class: Geometry
      Calculates the normal to the Geometry at the given Point. If the given Point is not on the surface of the Geometry the resulting behaviour is undefined.
      Specified by:
      normal in class Geometry
      Parameters:
      p - The Point at which to calculate the normal.
      Returns:
      A NormalizedVector perpendicular to the surface of the shape at the given Point.
    • intersect

      public java.util.List<Intersection> intersect​(LineSegment line)
      Description copied from interface: Intersectible
      Calculates all the intersections between a given LineSegment and this object.
      Parameters:
      line - The LineSegment to check for intersections.
      Returns:
      A list of all the intersections with the given LineSegment.
    • boundary

      public geometries.Boundary boundary()
      Description copied from interface: Intersectible
      Get the Boundary of this intersectible.
      Returns:
      The bounding box of this intersectible.