Package georegression.geometry
Class UtilPoint2D_F64
java.lang.Object
georegression.geometry.UtilPoint2D_F64
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Rectangle2D_F64
bounding
(List<Point2D_F64> points, @Nullable Rectangle2D_F64 bounding) Finds the minimal volumeRectangleLength2D_F64
which contains all the points.static RectangleLength2D_F64
bounding
(List<Point2D_F64> points, @Nullable RectangleLength2D_F64 bounding) Finds the minimal volumeRectangleLength2D_F64
which contains all the points.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.static List<Point2D_F64>
copy
(List<Point2D_F64> pts) static double
distance
(double x0, double y0, double x1, double y1) static double
distanceSq
(double x0, double y0, double x1, double y1) 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.static boolean
isEquals
(GeoTuple2D_F64 a, GeoTuple2D_F64 b, double tol) static Point2D_F64
mean
(Point2D_F64[] list, int offset, int length, @Nullable Point2D_F64 mean) Finds the point which has the mean location of all the points in the array.static Point2D_F64
mean
(Point2D_F64 a, Point2D_F64 b, @Nullable Point2D_F64 mean) Computes the mean/average of two points.static Point2D_F64
mean
(List<Point2D_F64> list, @Nullable Point2D_F64 mean) Finds the point which has the mean location of all the points in the list.static Point2D_F64
noiseNormal
(Point2D_F64 mean, double sigmaX, double sigmaY, Random rand, @Nullable Point2D_F64 output) static void
noiseNormal
(List<Point2D_F64> pts, double sigma, Random rand) static List<Point2D_F64>
orderCCW
(List<Point2D_F64> points) Puts the points into counter-clockwise order around their center.static List<Point2D_F64>
static List<Point2D_F64>
randomNorm
(Point2D_F64 mean, org.ejml.data.DMatrix covariance, int count, Random rand, @Nullable List<Point2D_F64> output) Randomly generates points from the specified normal distribution
-
Constructor Details
-
UtilPoint2D_F64
public UtilPoint2D_F64()
-
-
Method Details
-
findClosestIdx
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
-
noiseNormal
-
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
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 pointsmean
- 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 pointsoffset
- First index in listlength
- Length of elements in listmean
- Storage for mean point. If null then a new instance will be declared- Returns:
- The found mean
-
mean
Computes the mean/average of two points.- Parameters:
a
- (input) Point Ab
- (input) Point Bmean
- (output) average of 'a' and 'b'
-
random
-
isEquals
-
bounding
public static RectangleLength2D_F64 bounding(List<Point2D_F64> points, @Nullable @Nullable RectangleLength2D_F64 bounding) Finds the minimal volumeRectangleLength2D_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 volumeRectangleLength2D_F64
which contains all the points.- Parameters:
points
- Input: List of points.bounding
- Output: Bounding rectangle
-
orderCCW
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) pointsmean
- (Output) mean of the pointscovariance
- (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) meancovariance
- (Output) 2x2 covariance matrixcount
- (Input) Number of points to createrand
- (Input) Random number generatoroutput
- (Output) Optional storage for points. If null a new list is created- Returns:
- List containing points.
-