Package georegression.geometry
Class UtilPoint2D_F32
java.lang.Object
georegression.geometry.UtilPoint2D_F32
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Rectangle2D_F32bounding(List<Point2D_F32> points, @Nullable Rectangle2D_F32 bounding) Finds the minimal volumeRectangleLength2D_F32which contains all the points.static RectangleLength2D_F32bounding(List<Point2D_F32> points, @Nullable RectangleLength2D_F32 bounding) Finds the minimal volumeRectangleLength2D_F32which contains all the points.static voidcomputeNormal(List<Point2D_F32> points, Point2D_F32 mean, FMatrix covariance) Computes the mean and covariance matrix from the set of points.static List<Point2D_F32>copy(List<Point2D_F32> pts) static floatdistance(float x0, float y0, float x1, float y1) static floatdistanceSq(float x0, float y0, float x1, float y1) static intfindClosestIdx(float x, float y, List<Point2D_F32> pts, float tol) Finds the closest point in the list to the specified point that is within tolerance.static booleanisEquals(GeoTuple2D_F32 a, GeoTuple2D_F32 b, float tol) static Point2D_F32mean(Point2D_F32[] list, int offset, int length, @Nullable Point2D_F32 mean) Finds the point which has the mean location of all the points in the array.static Point2D_F32mean(Point2D_F32 a, Point2D_F32 b, @Nullable Point2D_F32 mean) Computes the mean/average of two points.static Point2D_F32mean(List<Point2D_F32> list, @Nullable Point2D_F32 mean) Finds the point which has the mean location of all the points in the list.static Point2D_F32noiseNormal(Point2D_F32 mean, float sigmaX, float sigmaY, Random rand, @Nullable Point2D_F32 output) static voidnoiseNormal(List<Point2D_F32> pts, float sigma, Random rand) static List<Point2D_F32>orderCCW(List<Point2D_F32> points) Puts the points into counter-clockwise order around their center.static List<Point2D_F32>static List<Point2D_F32>randomNorm(Point2D_F32 mean, FMatrix covariance, int count, Random rand, @Nullable List<Point2D_F32> output) Randomly generates points from the specified normal distribution
-
Constructor Details
-
UtilPoint2D_F32
public UtilPoint2D_F32()
-
-
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_F32 noiseNormal(Point2D_F32 mean, float sigmaX, float sigmaY, Random rand, @Nullable @Nullable Point2D_F32 output) -
distance
public static float distance(float x0, float y0, float x1, float y1) -
distanceSq
public static float distanceSq(float x0, float y0, float x1, float 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_F32 mean(Point2D_F32[] list, int offset, int length, @Nullable @Nullable Point2D_F32 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_F32 bounding(List<Point2D_F32> points, @Nullable @Nullable RectangleLength2D_F32 bounding) Finds the minimal volumeRectangleLength2D_F32which contains all the points.- Parameters:
points- Input: List of points.bounding- Output: Bounding rectangle
-
bounding
public static Rectangle2D_F32 bounding(List<Point2D_F32> points, @Nullable @Nullable Rectangle2D_F32 bounding) Finds the minimal volumeRectangleLength2D_F32which 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
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_F32> randomNorm(Point2D_F32 mean, FMatrix covariance, int count, Random rand, @Nullable @Nullable List<Point2D_F32> 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.
-