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
Intersectible
s which aggregates the intersections between rays and all its elements.-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
GeometryList.GeometriesIterator
Iterates over the leaves of the geometries hierarchy as if they were a flat collection ofGeometry
s. -
Constructor Summary
Constructors Constructor Description GeometryList(Geometry... geometries)
Construct a collection of geometries given an array ofIntersectible
s or given any number ofIntersectible
s. -
Method Summary
Modifier and Type Method Description void
add(Geometry... geometries)
Add manyGeometry
s to the collection.void
add(GeometryList geometries)
Add all theGeometry
s in the givenGeometryList
to the collection.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.java.util.Iterator<Geometry>
iterator()
void
optimize()
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, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
GeometryList
Construct a collection of geometries given an array ofIntersectible
s or given any number ofIntersectible
s.- Parameters:
geometries
- TheGeometryList
s to initialise the collection to.
-
-
Method Details
-
add
Add manyGeometry
s to the collection.- Parameters:
geometries
- TheGeometry
s to add.
-
add
Add all theGeometry
s in the givenGeometryList
to the collection.- Parameters:
geometries
- TheGeometryList
whose 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:Intersectible
Calculates all the intersections between a givenLineSegment
and this object.- Specified by:
intersect
in interfaceIntersectible
- 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.- Specified by:
boundary
in interfaceIntersectible
- Returns:
- The bounding box of this intersectible.
-
iterator
- Specified by:
iterator
in interfacejava.lang.Iterable<Geometry>
-