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. -
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 theBoundary
of this intersectible.java.util.List<Intersection>
intersect(LineSegment line)
Calculates all the intersections between a givenLineSegment
and this object.NormalizedVector
normal(Point p)
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
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
- TheMaterial
the 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
- TheMaterial
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
Description copied from class:Geometry
Calculates the normal to theGeometry
at the givenPoint
. If the givenPoint
is not on the surface of theGeometry
the resulting behaviour is undefined.- Specified by:
normal
in classGeometry
- Parameters:
p
- ThePoint
at which to calculate the normal.- Returns:
- A
NormalizedVector
perpendicular to the surface of the shape at the givenPoint
.
-
intersect
Description copied from interface:Intersectible
Calculates all the intersections between a givenLineSegment
and this object.- Parameters:
line
- TheLineSegment
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 theBoundary
of this intersectible.- Returns:
- The bounding box of this intersectible.
-