You are here: Start » FIL.NET » Function Reference » Path » Path Spatial Transforms » FIL.FitPathToPath
Rotates and shifts a path to minimize average distance between its points and a reference path.
Namespace: | FilNet |
---|---|
Assembly: | FIL.NET.dll |
Syntax
public static void FitPathToPath ( FilNet.Path inPath, FilNet.Path inReferencePath, FilNet.PathOrientationAlignment inPathOrientationAlignment, int inIterations, float inFirstShift, float inFirstRotation, FilNet.Path outPath, out FilNet.CoordinateSystem2D outAlignment, out float outPathDistance )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() | inPath | FilNet.Path | Path to be aligned. | ||
![]() | inReferencePath | FilNet.Path | Path to align to. | ||
![]() | inPathOrientationAlignment | FilNet.PathOrientationAlignment | EllipticAxes | Determines how to align paths orientation before the main algorithm. Default value: EllipticAxes. | |
![]() | inIterations | int | <1, INF> | 5 | Number of algorithm steps. Default value: 5. |
![]() | inFirstShift | float | 10.0f | Magnitude of possible shift at the first step in pixels. Default value: 10.0f. | |
![]() | inFirstRotation | float | 10.0f | Magnitude of possible rotation at the first step in degrees. Default value: 10.0f. | |
![]() | outPath | FilNet.Path | Aligned path. | ||
![]() | outAlignment | FilNet.CoordinateSystem2D | The coordinate system that geometrical objects defined in the context of the path should be aligned to. | ||
![]() | outPathDistance | float | 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.
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | Empty path on input in FitPathToPath. |