public class PlaneParallelLineGenerator extends Object implements ParallelLineGenerator
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.
ParallelLineGenerator.Line
Constructor and Description |
---|
PlaneParallelLineGenerator(I interval,
org.joml.Quaterniondc direction,
BinaryHybridCFI1<org.joml.Vector3d,org.joml.Quaterniondc,org.joml.Vector3d> rotateOp,
long sections)
Creates and initializes an instance for generating lines.
|
Modifier and Type | Method and Description |
---|---|
org.joml.Vector3dc |
getDirection()
Returns the direction of the lines this generator creates
|
ParallelLineGenerator.Line |
nextLine()
Generates the next random line.
|
void |
reset()
Resets the cycle of the line generation
|
void |
setSeed(long seed)
Sets the seed of the underlying random number generator
|
public PlaneParallelLineGenerator(I interval, org.joml.Quaterniondc direction, BinaryHybridCFI1<org.joml.Vector3d,org.joml.Quaterniondc,org.joml.Vector3d> rotateOp, long sections) throws IllegalArgumentException
I
- type of the interval.interval
- a 3D interval through which the lines pass.direction
- the direction of the lines through the interval described as a rotation.rotateOp
- an op the generator needs for rotating vectorssections
- number of sections each line point coordinate is generated from.IllegalArgumentException
- if sections is not positive, or interval is not 3D.public ParallelLineGenerator.Line nextLine()
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!
nextLine
in interface ParallelLineGenerator
public org.joml.Vector3dc getDirection()
getDirection
in interface ParallelLineGenerator
public void setSeed(long seed)
seed
- seed valueRandomGenerator.setSeed(long)
public void reset()
nextLine()
Copyright © 2018–2022 BoneJ. All rights reserved.