Class UtilPoint2D_F64

java.lang.Object
georegression.geometry.UtilPoint2D_F64

public class UtilPoint2D_F64 extends Object
  • Constructor Details

    • UtilPoint2D_F64

      public UtilPoint2D_F64()
  • Method Details

    • findClosestIdx

      public static int findClosestIdx(double x, double y, List<Point2D_F64> pts, double tol)
      Finds the closest point in the list to the specified point that is within tolerance. Returns the index of the point or -1 if none was found.
      Parameters:
      tol - Tolerance in Euclidean distance.
    • copy

      public static List<Point2D_F64> copy(List<Point2D_F64> pts)
    • noiseNormal

      public static void noiseNormal(List<Point2D_F64> pts, double sigma, Random rand)
    • noiseNormal

      public static Point2D_F64 noiseNormal(Point2D_F64 mean, double sigmaX, double sigmaY, Random rand, @Nullable @Nullable Point2D_F64 output)
    • distance

      public static double distance(double x0, double y0, double x1, double y1)
    • distanceSq

      public static double distanceSq(double x0, double y0, double x1, double y1)
    • mean

      public static Point2D_F64 mean(List<Point2D_F64> list, @Nullable @Nullable Point2D_F64 mean)
      Finds the point which has the mean location of all the points in the list. This is also known as the centroid.
      Parameters:
      list - List of points
      mean - Storage for mean point. If null then a new instance will be declared
      Returns:
      The found mean
    • mean

      public static Point2D_F64 mean(Point2D_F64[] list, int offset, int length, @Nullable @Nullable Point2D_F64 mean)
      Finds the point which has the mean location of all the points in the array. This is also known as the centroid.
      Parameters:
      list - List of points
      offset - First index in list
      length - Length of elements in list
      mean - Storage for mean point. If null then a new instance will be declared
      Returns:
      The found mean
    • mean

      public static Point2D_F64 mean(Point2D_F64 a, Point2D_F64 b, @Nullable @Nullable Point2D_F64 mean)
      Computes the mean/average of two points.
      Parameters:
      a - (input) Point A
      b - (input) Point B
      mean - (output) average of 'a' and 'b'
    • random

      public static List<Point2D_F64> random(double min, double max, int num, Random rand)
    • isEquals

      public static boolean isEquals(GeoTuple2D_F64 a, GeoTuple2D_F64 b, double tol)
    • bounding

      public static RectangleLength2D_F64 bounding(List<Point2D_F64> points, @Nullable @Nullable RectangleLength2D_F64 bounding)
      Finds the minimal volume RectangleLength2D_F64 which contains all the points.
      Parameters:
      points - Input: List of points.
      bounding - Output: Bounding rectangle
    • bounding

      public static Rectangle2D_F64 bounding(List<Point2D_F64> points, @Nullable @Nullable Rectangle2D_F64 bounding)
      Finds the minimal volume RectangleLength2D_F64 which contains all the points.
      Parameters:
      points - Input: List of points.
      bounding - Output: Bounding rectangle
    • orderCCW

      public static List<Point2D_F64> orderCCW(List<Point2D_F64> points)
      Puts the points into counter-clockwise order around their center.
      Parameters:
      points - List of points. Not modified.
      Returns:
      ordered list
    • computeNormal

      public static void computeNormal(List<Point2D_F64> points, Point2D_F64 mean, org.ejml.data.DMatrix covariance)
      Computes the mean and covariance matrix from the set of points. This describes a normal distribution
      Parameters:
      points - (Input) points
      mean - (Output) mean of the points
      covariance - (Output) 2x2 covariance matrix
    • randomNorm

      public static List<Point2D_F64> randomNorm(Point2D_F64 mean, org.ejml.data.DMatrix covariance, int count, Random rand, @Nullable @Nullable List<Point2D_F64> output)
      Randomly generates points from the specified normal distribution
      Parameters:
      mean - (Input) mean
      covariance - (Output) 2x2 covariance matrix
      count - (Input) Number of points to create
      rand - (Input) Random number generator
      output - (Output) Optional storage for points. If null a new list is created
      Returns:
      List containing points.