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 NormalizedVectornormalThe normal vector of the plane.PointpointA point on the plane. -
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.Boundaryboundary()Get theBoundaryof this intersectible.java.util.List<Intersection>intersect(LineSegment line)Calculates all the intersections between a givenLineSegmentand this object.NormalizedVectornormal(Point p)Methods inherited from class geometries.Geometry
intersectionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
point
A point on the plane. -
normal
The normal vector of the plane.
-
-
Constructor Details
-
Plane
This constructor accepts a point on the plane and a vector perpendicular to the plane.- Parameters:
material- TheMaterialthe plane is made from.point- A point on the plane.normal- A normalized vector perpendicular to the plane.
-
Plane
This constructor accepts three distinct points on the plane.- Parameters:
material- TheMaterialthe 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
Description copied from class:GeometryCalculates the normal to theGeometryat the givenPoint. If the givenPointis not on the surface of theGeometrythe resulting behaviour is undefined.- Specified by:
normalin classGeometry- Parameters:
p- ThePointat which to calculate the normal.- Returns:
- A
NormalizedVectorperpendicular to the surface of the shape at the givenPoint.
-
intersect
Description copied from interface:IntersectibleCalculates all the intersections between a givenLineSegmentand this object.- Parameters:
line- TheLineSegmentto check for intersections.- Returns:
- A list of all the intersections with the given
LineSegment.
-
boundary
public geometries.Boundary boundary()Description copied from interface:IntersectibleGet theBoundaryof this intersectible.- Returns:
- The bounding box of this intersectible.
-