You are here: Start » AVL.NET » Function Reference » Path » Path Metrics » AVL.PathToPathDistance

AVL.PathToPathDistance

Computes the minimum distance between two paths.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

C++
C#
 
public static void PathToPathDistance
(
	AvlNet.Path inPath1,
	AvlNet.Path inPath2,
	AvlNet.PathDistanceMode inPathDistanceMode,
	float inResolution,
	out float outDistance,
	NullableValue<AvlNet.Segment2D> outConnectingSegment
)

Parameters

Name Type Range Default Description
inPath1AvlNet.PathFirst input path.
inPath2AvlNet.PathSecond input path.
inPathDistanceModeAvlNet.PathDistanceModeDistance measuring method.
inResolutionfloat<0.0f, INF>1.0fDefault value: 1.0f.
outDistancefloatMinimal distance between input paths.
outConnectingSegmentAvlNet.NullableValue<AvlNet.Segment2D>Segment connecting input paths having minimal length. Can be null to skip this parameter calculation.

Description

The operation finds the minimal distance between a characteristic point of inPath1 and path inPath2. The distance between a point and a path is computed as follows, depending on the value of inPathDistanceMode:

  • The distance to nearest characteristic point of inPath2, if inPathDistanceMode is set to PointToPoint.
  • The minimal distance to inPath2 segments adjacent to the nearest characteristic point of inPath2 (which is much more precise), if inPathDistanceMode is set to PointToSegment.

The operation computes the outDistance distance and, additionally, the outConnectingSegment line segment corresponding to the result.

Examples

The PathToPathDistance run on the sample paths produces outDistance = 9.509.

The resulting outConnectingSegment drawn onto the input paths.

Errors

List of possible exceptions:

Error type Description
DomainError One or both input paths are empty in PathToPathDistance.

Function Overrides

See also