java.lang.Object
imagingbook.common.geometry.fitting.line.utils.LineSampler

public class LineSampler extends Object

Instances of this class are used to randomly sample points along a given straight line segment, x/y coordinates being perturbed with Gaussian noise. Mainly used for testing line fitters.

Version:
2022/09/29
  • Constructor Details

    • LineSampler

      public LineSampler(Pnt2d p1, Pnt2d p2)
      Constructor (with no specific seed).
      Parameters:
      p1 - first point of the line segment
      p2 - second point of the line segment
    • LineSampler

      public LineSampler(Pnt2d p1, Pnt2d p2, long seed)
      Constructor (with specific random seed).
      Parameters:
      p1 - first point of the line segment
      p2 - second point of the line segment
      seed - random seed (pass 0 for complete randomness)
  • Method Details

    • getPoints

      public Pnt2d[] getPoints(int n, double sigma)
      Returns an array of randomly sampled points.
      Parameters:
      n - the number of points
      sigma - standard deviation of Gaussian position noise
      Returns:
      an array of random points