You are here: Start » AVL.NET » AVL.FitPathToPath(AvlNet.Path, AvlNet.Path, AvlNet.PathOrientationAlignment, int, float, float, AvlNet.Path, AvlNet.CoordinateSystem2D, float)
AVL.FitPathToPath(AvlNet.Path, AvlNet.Path, AvlNet.PathOrientationAlignment, int, float, float, AvlNet.Path, AvlNet.CoordinateSystem2D, float)
Rotates and shifts a path to minimize average distance between its points and a reference path.
| Namespace: | AvlNet |
|---|---|
| Assembly: | AVL.NET.dll |
Syntax
public static void FitPathToPath( AvlNet.Path inPath, AvlNet.Path inReferencePath, AvlNet.PathOrientationAlignment inPathOrientationAlignment, int inIterations, float inFirstShift, float inFirstRotation, out AvlNet.Path outPath, out AvlNet.CoordinateSystem2D outAlignment, out float outPathDistance )
Parameters
- inPath
- Type: AvlNet.Path
Path to be aligned - inReferencePath
- Type: AvlNet.Path
Path to align to - inPathOrientationAlignment
- Type: AvlNet.PathOrientationAlignment
Determines how to align paths orientation before the main algorithm - inIterations
- Type: System.Int32
Number of algorithm steps - inFirstShift
- Type: System.Single
Magnitude of possible shift at the first step in pixels - inFirstRotation
- Type: System.Single
Magnitude of possible rotation at the first step in degrees - outPath
- Type: AvlNet.Path
Aligned path - outAlignment
- Type: AvlNet.CoordinateSystem2D
The coordinate system that geometrical objects defined in the context of the path should be aligned to - outPathDistance
- Type: System.Single
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:
- Shifts of the processed path in four major directions by ShiftMagnitude pixels
- 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
![]() |
![]() |
FitPathToPath run on the sample paths with inIterations = 5, inFirstShift = 10, inFirstRotation = 10. The inReferencePath plotted in grey, the inPath/outPath in black.


