Table of Contents

Method Distance

Namespace
LMKit.Graphics.Geometry
Assembly
LM-Kit.NET.dll

Distance(Point, Point)

Calculates the Euclidean distance between two points.

public static double Distance(Point p1, Point p2)

Parameters

p1 Point

The first point.

p2 Point

The second point.

Returns

double

The Euclidean distance between p1 and p2.

Distance(IPoint, IPoint)

Calculates the Euclidean distance between two points provided via IPoint.

public static double Distance(IPoint p1, IPoint p2)

Parameters

p1 IPoint

The first point.

p2 IPoint

The second point.

Returns

double

The Euclidean distance between the two points.

Distance(double, double, double, double)

Calculates the Euclidean distance between two 2D points provided as raw coordinate pairs.

public static double Distance(double x1, double y1, double x2, double y2)

Parameters

x1 double

The X-coordinate of the first point.

y1 double

The Y-coordinate of the first point.

x2 double

The X-coordinate of the second point.

y2 double

The Y-coordinate of the second point.

Returns

double

The Euclidean distance between x1, y1 and x2, y2.

Examples

double d = Point.Distance(0, 0, 3, 4); // 5

Remarks

For maximum performance when only relative comparisons are needed, use DistanceSquared(double, double, double, double) to avoid the square-root.

See Also