Class SpiralSampling


  • public class SpiralSampling
    extends java.lang.Object
    Creates samples on a spiral around a center point.
    Author:
    Kai Burjack
    • Constructor Summary

      Constructors 
      Constructor Description
      SpiralSampling​(long seed)
      Create a new instance of SpiralSampling and initialize the random number generator with the given seed.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void createEquiAngle​(float radius, int numRotations, int numSamples, float jitter, Callback2d callback)
      Create numSamples number of samples on a spiral with maximum radius radius around the center using numRotations number of rotations along the spiral, and call the given callback for each sample generated.
      void createEquiAngle​(float radius, int numRotations, int numSamples, Callback2d callback)
      Create numSamples number of samples on a spiral with maximum radius radius around the center using numRotations number of rotations along the spiral, and call the given callback for each sample generated.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SpiralSampling

        public SpiralSampling​(long seed)
        Create a new instance of SpiralSampling and initialize the random number generator with the given seed.
        Parameters:
        seed - the seed to initialize the random number generator with
    • Method Detail

      • createEquiAngle

        public void createEquiAngle​(float radius,
                                    int numRotations,
                                    int numSamples,
                                    Callback2d callback)
        Create numSamples number of samples on a spiral with maximum radius radius around the center using numRotations number of rotations along the spiral, and call the given callback for each sample generated.

        The generated sample points are distributed with equal angle differences around the spiral, so they concentrate towards the center.

        Parameters:
        radius - the maximum radius of the spiral
        numRotations - the number of rotations of the spiral
        numSamples - the number of samples to generate
        callback - will be called for each sample generated
      • createEquiAngle

        public void createEquiAngle​(float radius,
                                    int numRotations,
                                    int numSamples,
                                    float jitter,
                                    Callback2d callback)
        Create numSamples number of samples on a spiral with maximum radius radius around the center using numRotations number of rotations along the spiral, and call the given callback for each sample generated.

        The generated sample points are distributed with equal angle differences around the spiral, so they concentrate towards the center.

        Additionally, the radius of each sample point is jittered by the given jitter factor.

        Parameters:
        radius - the maximum radius of the spiral
        numRotations - the number of rotations of the spiral
        numSamples - the number of samples to generate
        jitter - the factor by which the radius of each sample point is jittered. Possible values are [0..1]
        callback - will be called for each sample generated