Start » Filter Reference » Path » Path Spatial Transforms » FitPathToPath

FitPathToPath


Module: FoundationPro

Rotates and shifts a path to minimize average distance between its points and a reference path.

Name Type Range Description
Input value
inPath Path Path to be aligned
Input value
inReferencePath Path Path to align to
Input value
inPathOrientationAlignment PathOrientationAlignment Determines how to align paths orientation before the main algorithm
Input value
inIterations Integer 1 - Number of algorithm steps
Input value
inFirstShift Real Magnitude of possible shift at the first step in pixels
Input value
inFirstRotation Real Magnitude of possible rotation at the first step in degrees
Output value
outPath Path Aligned path
Output value
outAlignment CoordinateSystem2D The coordinate system that geometrical objects defined in the context of the path should be aligned to
Output value
outPathDistance Real Average distance of characteristic points of the input path from the reference path

Description

The operations repeatedly performs shifts and rotations on the inPath minimizing the average distance between its characteristic points and inReferencePath.

Initially the inPath is shifted so that its mass center is equals the mass center of inReferencePath. Then the alignment is performed in inIterations steps. At each step the algorithm considers:

  1. Shifts of the processed path in four major directions by ShiftMagnitude pixels
  2. Rotations of the processed path in clockwise and counter-clockwise direction by RotationMagnitude degrees

At each substep the operation performs shift or rotation that produces the best distance minimization results. The initial value of ShiftMagnitude is inFirstShift and at each step it is divided by 2. Analogically the initial value of RotationMagnitude is inFirstRotation and at each step it is divided by 2.

Examples

Description of usage of this filter can be found in examples and tutorial: Capsules.

FitPathToPath run on the sample paths with inIterations = 5, inFirstShift = 10, inFirstRotation = 10. The inReferencePath plotted in grey, the inPath/outPath in black.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Empty path on input in FitPathToPath.

Complexity Level

This filter is available on Advanced Complexity Level.