Package geometries
Class GeometryList
java.lang.Object
geometries.GeometryList
- All Implemented Interfaces:
Intersectible,java.lang.Iterable<Geometry>
public class GeometryList extends java.lang.Object implements Intersectible, java.lang.Iterable<Geometry>
A collection of
Intersectibles which aggregates the intersections between rays and all its elements.-
Nested Class Summary
Nested Classes Modifier and Type Class Description classGeometryList.GeometriesIteratorIterates over the leaves of the geometries hierarchy as if they were a flat collection ofGeometrys. -
Constructor Summary
Constructors Constructor Description GeometryList(Geometry... geometries)Construct a collection of geometries given an array ofIntersectibles or given any number ofIntersectibles. -
Method Summary
Modifier and Type Method Description voidadd(Geometry... geometries)Add manyGeometrys to the collection.voidadd(GeometryList geometries)Add all theGeometrys in the givenGeometryListto the collection.geometries.Boundaryboundary()Get theBoundaryof this intersectible.java.util.List<Intersection>intersect(LineSegment line)Calculates all the intersections between a givenLineSegmentand this object.java.util.Iterator<Geometry>iterator()voidoptimize()Restructures the internal structure of the geometries for optimal ray tracing.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
GeometryList
Construct a collection of geometries given an array ofIntersectibles or given any number ofIntersectibles.- Parameters:
geometries- TheGeometryLists to initialise the collection to.
-
-
Method Details
-
add
Add manyGeometrys to the collection.- Parameters:
geometries- TheGeometrys to add.
-
add
Add all theGeometrys in the givenGeometryListto the collection.- Parameters:
geometries- TheGeometryListwhose elements to add.
-
optimize
public void optimize()Restructures the internal structure of the geometries for optimal ray tracing. This method should be called after all the geometries have been added, but before the ray tracing process begins. -
intersect
Description copied from interface:IntersectibleCalculates all the intersections between a givenLineSegmentand this object.- Specified by:
intersectin interfaceIntersectible- 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.- Specified by:
boundaryin interfaceIntersectible- Returns:
- The bounding box of this intersectible.
-
iterator
- Specified by:
iteratorin interfacejava.lang.Iterable<Geometry>
-