Class PlaneParallelLineGenerator

java.lang.Object
org.bonej.ops.mil.PlaneParallelLineGenerator
All Implemented Interfaces:
ParallelLineGenerator

public class PlaneParallelLineGenerator extends Object implements ParallelLineGenerator
A class that generates random lines that pass through a plane.

All the lines pass through a point on a d * d plane, where d = the longest diagonal of a 3D interval. The lines are also normal to the plane.

The plane is d * d so that it's big enough that normal lines passing through it cover the entire interval, regardless of the orientation of the plane. However, this means that nextLine() might return a line that entirely misses the interval.

Author:
Richard Domander
  • Constructor Details

  • Method Details

    • nextLine

      public ParallelLineGenerator.Line nextLine()
      Generates the next random line.

      If the class is initialised with more than one section, then lines pass the plane cyclically through each section. For example, if sections == 2 then the next four lines come from the four different quadrants of the plane. Calling nextLine() for the fifth time resets the cycle. Each line has the same random offset within its section. This offset is randomized when the cycle resets. The order of the quadrants is randomised as well.

      NB: the line might miss the interval the class was initialised with!

      Specified by:
      nextLine in interface ParallelLineGenerator
      Returns:
      a line passing through a point on a plane described by the class.
    • getDirection

      public org.joml.Vector3dc getDirection()
      Returns the direction of the lines this generator creates
      Specified by:
      getDirection in interface ParallelLineGenerator
      Returns:
      direction as a unit vector
    • setSeed

      public void setSeed(long seed)
      Sets the seed of the underlying random number generator
      Parameters:
      seed - seed value
      See Also:
      • RandomGenerator.setSeed(long)
    • reset

      public void reset()
      Resets the cycle of the line generation
      See Also: