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
    class  GeometryList.GeometriesIterator
    Iterates over the leaves of the geometries hierarchy as if they were a flat collection of Geometrys.
  • Constructor Summary

    Constructors
    Constructor Description
    GeometryList​(Geometry... geometries)
    Construct a collection of geometries given an array of Intersectibles or given any number of Intersectibles.
  • Method Summary

    Modifier and Type Method Description
    void add​(Geometry... geometries)
    Add many Geometrys to the collection.
    void add​(GeometryList geometries)
    Add all the Geometrys in the given GeometryList to the collection.
    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.
    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

      public GeometryList​(Geometry... geometries)
      Construct a collection of geometries given an array of Intersectibles or given any number of Intersectibles.
      Parameters:
      geometries - The GeometryLists to initialise the collection to.
  • Method Details

    • add

      public void add​(Geometry... geometries)
      Add many Geometrys to the collection.
      Parameters:
      geometries - The Geometrys to add.
    • add

      public void add​(GeometryList geometries)
      Add all the Geometrys in the given GeometryList to the collection.
      Parameters:
      geometries - The GeometryList 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

      public java.util.List<Intersection> intersect​(LineSegment line)
      Description copied from interface: Intersectible
      Calculates all the intersections between a given LineSegment and this object.
      Specified by:
      intersect in interface Intersectible
      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.
      Specified by:
      boundary in interface Intersectible
      Returns:
      The bounding box of this intersectible.
    • iterator

      public java.util.Iterator<Geometry> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<Geometry>