Back to Aurora Vision Library website

You are here: Start » Function Reference » Path » Path Metrics » PathToPathDistance

PathToPathDistance


Header: AVL.h
Namespace: avl
Module: FoundationPro

Computes the minimum distance between two paths.

Syntax

C++
C#
 
void avl::PathToPathDistance
(
	const avl::Path& inPath1,
	const avl::Path& inPath2,
	avl::PathDistanceMode::Type inPathDistanceMode,
	float inResolution,
	float& outDistance,
	atl::Optional<avl::Segment2D&> outConnectingSegment = atl::NIL
)

Parameters

Name Type Range Default Description
Input value inPath1 const Path& First input path
Input value inPath2 const Path& Second input path
Input value inPathDistanceMode PathDistanceMode::Type Distance measuring method
Input value inResolution float 0.0 - 1.0f
Output value outDistance float& Minimal distance between input paths
Output value outConnectingSegment Optional<Segment2D&> NIL Segment connecting input paths having minimal length

Optional Outputs

The computation of following outputs can be switched off by passing value atl::NIL to these parameters: outConnectingSegment.

Read more about Optional Outputs.

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.

See Also