Back to Adaptive Vision Library website

You are here: Start » Function Reference » Path Combinators » JoinAdjacentPaths

JoinAdjacentPaths


Joins those paths of an array which endpoints lie near enough.

Header:AVL.h

Syntax

C++
C#
 
void avl::JoinAdjacentPaths
(
	const atl::Array<avl::Path>& inPaths,
	float inMaxJoiningDistance,
	float inMaxJoiningAngle,
	float inJoiningDistanceBalance,
	atl::Optional<float> inJoiningEndingLength,
	float inMinPathLength,
	atl::Array<avl::Path>& outPaths
)

Parameters

Name Type Range Default Description
inPaths const Array<Path>&
inMaxJoiningDistance float 0.0 - 10.0f Maximal distance between edges that can be joined
inMaxJoiningAngle float 0.0 - 180.0 30.0f Maximal allowed angle between edges being joined
inJoiningDistanceBalance float 0.0 - 1.0 1.0f Determines how important distance between paths is according to their angle difference
inJoiningEndingLength Optional<float> 1.0 - NIL Determines the length of the path end used for path angle computing
inMinPathLength float 0.0 - 0.0f Minimal length of a path
outPaths Array<Path>&

Description

The operation repeatedly connects the least distant pair of endpoints of open paths of an array until no such pair can be connected. An endpoint can be joined with another one in its vicinity only if the distance between them is not greater than inMaxJoiningDistance and neither of them forms an angle greater than inMaxJoiningAngle with the segment connecting them. The inJoiningEndingLength parameter determines what part of the path ending is used to determine above mentioned turn angle. If it is set to Nil, only the last path segment is decisive. Sometimes two or more path endings can be joined with an ending. Because only one of them can be, each of the candidates is evaluated based on the distance from the fixed path's ending and the turn angle associated with their connection. The greater inJoiningDistanceBalance is, the less influence on the evaluation score the latter value has. After the joining phase, paths that are shorter than inMinPathLength are removed from the final results.

Examples

JoinAdjacentPaths run on the sample path array with inMaxJoiningDistance = 25.

JoinAdjacentPaths run on the sample path array with inMaxJoiningDistance = 1000.

See Also

  • ClosePath – Adds the segment connecting last point to the first one to a path.