Class Distance2D_F64

java.lang.Object
georegression.metric.Distance2D_F64

public class Distance2D_F64 extends Object
Functions related to finding the distance of one shape from another shape. This is often closely related to finding the `closest point`.
• Constructor Summary

Constructors
Constructor
Description
`Distance2D_F64()`

• Method Summary

Modifier and Type
Method
Description
`static double`
```distance(EllipseRotated_F64 ellipse, Point2D_F64 p)```
Euclidean distance of closest point on ellipse to point 'p'.
`static double`
```distance(LineGeneral2D_F64 line, Point2D_F64 p)```
Returns the Euclidean distance of the closest point on the line to the specified point.
`static double`
```distance(LineParametric2D_F64 line, double x, double y)```
Returns the Euclidean distance of the closest point on the line from a point.
`static double`
```distance(LineParametric2D_F64 line, Point2D_F64 p)```
Returns the Euclidean distance of the closest point on the line from a point.
`static double`
```distance(LineSegment2D_F64 line, double x, double y)```
Returns the Euclidean distance of the closest point on a line segment to the specified point.
`static double`
```distance(LineSegment2D_F64 segmentA, LineSegment2D_F64 segmentB)```
Finds the distance between the two line segments
`static double`
```distance(LineSegment2D_F64 line, Point2D_F64 p)```
Returns the Euclidean distance of the closest point on a line segment to the specified point.
`static double`
```distance(Polygon2D_F64 poly, Point2D_F64 p)```
Returns the Euclidean distance of the closest point on the Polygon to the provided point.
`static double`
```distance(Quadrilateral_F64 quad, Point2D_F64 p)```
Returns the Euclidean distance of the closest point on the quadrilateral to the provided point.
`static double`
```distance2(EllipseRotated_F64 ellipse, Point2D_F64 p)```
Euclidean distance squared of closest point on ellipse to point 'p'.
`static double`
```distanceNorm(LineGeneral2D_F64 line, Point2D_F64 p)```
Returns the signed Euclidean distance of the closest point on the line to the specified point.
`static double`
`distanceOrigin(LineParametric2D_F64 line)`
Returns the distance of the closest point on the line from the origin
`static double`
```distanceSq(LineParametric2D_F64 line, double x, double y)```
Returns the Euclidean distance squared of the closest point on the line from a point.
`static double`
```distanceSq(LineParametric2D_F64 line, Point2D_F64 p)```
Returns the Euclidean distance squared of the closest point on the line from a point.
`static double`
```distanceSq(LineSegment2D_F64 line, double x, double y)```
Returns the Euclidean distance squared of the closest point on a line segment to the specified point.
`static double`
```distanceSq(LineSegment2D_F64 segmentA, LineSegment2D_F64 segmentB)```
Finds the distance squared between the two line segments
`static double`
```distanceSq(LineSegment2D_F64 line, Point2D_F64 p)```
Returns the Euclidean distance squared of the closest point on a line segment to the specified point.
`static double`
```distanceSq(Polygon2D_F64 poly, Point2D_F64 p, @Nullable LineSegment2D_F64 storage)```
Returns the Euclidean distance squared of the closest point on the Polygon to the provided point.
`static double`
```distanceSq(Quadrilateral_F64 quad, Point2D_F64 p)```
Returns the Euclidean distance squared of the closest point on the quadrilateral to the provided point.
`static double`
```scoreIoU(Polygon2D_F64 a, Polygon2D_F64 b, @Nullable AreaIntersectionPolygon2D_F64 computeArea)```
Returns the Intersection Over Union (IoU) score for two simple polygon
`static double`
```scoreIoU(Rectangle2D_F64 a, Rectangle2D_F64 b)```
Returns the Intersection Over Union (IoU) score

Methods inherited from class java.lang.Object

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

• Distance2D_F64

public Distance2D_F64()
• Method Details

• distance

public static double distance(LineParametric2D_F64 line, Point2D_F64 p)

Returns the Euclidean distance of the closest point on the line from a point.

Parameters:
`line` - A line segment. Not modified.
`p` - The point. Not modified.
Returns:
Distance the closest point on the line is away from the point.
• distance

public static double distance(LineParametric2D_F64 line, double x, double y)

Returns the Euclidean distance of the closest point on the line from a point.

Parameters:
`line` - A line segment. Not modified.
`x` - Point's x-coordinate
`y` - Point's y-coordinate
Returns:
Distance the closest point on the line is away from the point.
• distanceSq

public static double distanceSq(LineParametric2D_F64 line, Point2D_F64 p)

Returns the Euclidean distance squared of the closest point on the line from a point.

Parameters:
`line` - A line segment. Not modified.
`p` - The point. Not modified.
Returns:
Euclidean distance squared to the closest point on the line is away from the point.
• distanceSq

public static double distanceSq(LineParametric2D_F64 line, double x, double y)

Returns the Euclidean distance squared of the closest point on the line from a point.

Parameters:
`line` - A line segment. Not modified.
`x` - Point's x-coordinate
`y` - Point's y-coordinate
Returns:
Euclidean distance squared to the closest point on the line is away from the point.
• distance

public static double distance(LineSegment2D_F64 line, Point2D_F64 p)

Returns the Euclidean distance of the closest point on a line segment to the specified point.

Parameters:
`line` - A line segment. Not modified.
`p` - The point. Not modified.
Returns:
Euclidean distance of the closest point on a line is away from a point.
• distance

public static double distance(LineSegment2D_F64 line, double x, double y)

Returns the Euclidean distance of the closest point on a line segment to the specified point.

Parameters:
`line` - A line segment. Not modified.
`x` - Point's x-coordinate
`y` - Point's y-coordinate
Returns:
Euclidean distance of the closest point on a line is away from a point.
• distanceSq

public static double distanceSq(LineSegment2D_F64 line, Point2D_F64 p)

Returns the Euclidean distance squared of the closest point on a line segment to the specified point.

Parameters:
`line` - A line segment. Not modified.
`p` - The point. Not modified.
Returns:
Euclidean distance squared of the closest point on a line is away from a point.
• distanceSq

public static double distanceSq(LineSegment2D_F64 line, double x, double y)

Returns the Euclidean distance squared of the closest point on a line segment to the specified point.

Parameters:
`line` - Line segment. Not modified.
`x` - Point's x-coordinate
`y` - Point's y-coordinate
Returns:
Euclidean distance squared of the closest point on a line is away from a point.
• distance

public static double distance(LineSegment2D_F64 segmentA, LineSegment2D_F64 segmentB)
Finds the distance between the two line segments
Parameters:
`segmentA` - Line segment. Not modified.
`segmentB` - Line segment. Not modified.
Returns:
Euclidean distance of the closest point between the two line segments.
• distanceSq

public static double distanceSq(LineSegment2D_F64 segmentA, LineSegment2D_F64 segmentB)
Finds the distance squared between the two line segments
Parameters:
`segmentA` - Line segment. Not modified.
`segmentB` - Line segment. Not modified.
Returns:
Euclidean distance squared of the closest point between the two line segments.
• distance

Returns the Euclidean distance of the closest point on the quadrilateral to the provided point.
Parameters:
`quad` - Quadrilateral
`p` - Point
Returns:
Distance apart
• distanceSq

Returns the Euclidean distance squared of the closest point on the quadrilateral to the provided point.
Parameters:
`quad` - Quadrilateral
`p` - Point
Returns:
Distance squared apart
• distance

public static double distance(Polygon2D_F64 poly, Point2D_F64 p)
Returns the Euclidean distance of the closest point on the Polygon to the provided point.
Parameters:
`poly` - Polygon2D
`p` - Point
Returns:
Distance squared apart
• distanceSq

public static double distanceSq(Polygon2D_F64 poly, Point2D_F64 p, @Nullable @Nullable LineSegment2D_F64 storage)
Returns the Euclidean distance squared of the closest point on the Polygon to the provided point.
Parameters:
`poly` - Polygon2D
`p` - Point
`storage` - Optional storage for linesegment which is used internally to compute the distance
Returns:
Distance squared apart
• distance

public static double distance(LineGeneral2D_F64 line, Point2D_F64 p)

Returns the Euclidean distance of the closest point on the line to the specified point.

Parameters:
`line` - A line. Not modified.
`p` - The point. Not modified.
Returns:
Euclidean distance of the closest point on the line to the specified point.
• distanceNorm

public static double distanceNorm(LineGeneral2D_F64 line, Point2D_F64 p)

Returns the signed Euclidean distance of the closest point on the line to the specified point. The line is assumed be normalized. See `LineGeneral2D_F64` for details on normalization.

Parameters:
`line` - A normalized line. Not modified.
`p` - The point. Not modified.
Returns:
Euclidean distance of the closest point on the line to the specified point.
• distanceOrigin

public static double distanceOrigin(LineParametric2D_F64 line)
Returns the distance of the closest point on the line from the origin
Parameters:
`line` - Line
Returns:
Euclidean distance
• distance

public static double distance(EllipseRotated_F64 ellipse, Point2D_F64 p)
Euclidean distance of closest point on ellipse to point 'p'.
Parameters:
`ellipse` - Ellipse
`p` - Point
Returns:
Euclidean distance
• distance2

public static double distance2(EllipseRotated_F64 ellipse, Point2D_F64 p)
Euclidean distance squared of closest point on ellipse to point 'p'.
Parameters:
`ellipse` - Ellipse
`p` - Point
Returns:
Euclidean distance squared
• scoreIoU

public static double scoreIoU
Returns the Intersection Over Union (IoU) score
Parameters:
`a` - (Input) rectangle
`b` - (Input) rectangle
Returns:
IoU score
• scoreIoU

public static double scoreIoU(Polygon2D_F64 a, Polygon2D_F64 b, @Nullable @Nullable AreaIntersectionPolygon2D_F64 computeArea)
Returns the Intersection Over Union (IoU) score for two simple polygon
Parameters:
`a` - (Input) Simple polygon
`b` - (Input) Simple polygon
Returns:
IoU score