A collection of static methods for analyzing and comparing 2D curves.
CurveAnalysis
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| ArrSum | 1 | Sums all elements in a list of numbers. |
| ArrAverage | 1 | Calculates the average of a list of numbers. |
| Subtract | 1 | Subtracts point v2 from v1. |
| Magnitude | 1 | Calculates the magnitude (length) of a vector from the origin. |
| FrechetDist | 1 | Discrete Frechet distance between 2 curves. |
| ShapeSimilarity | 1 | Estimate how similar the shapes of 2 curves are to each other, accounting for translation, scale, and rotation. |
| ProcrustesNormalizeCurve | 1 | Translate and scale curve by Procrustes Analysis. |
| FindProcrustesRotationAngle | 1 | Find the angle to rotate curve to match the rotation of relativeCurve using procrustes analysis. |
| ProcrustesNormalizeRotation | 1 | Rotate curve to match the rotation of relativeCurve using procrustes analysis. |
| PointDistance | 1 | Calculate the distance between 2 points. |
| CurveLength | 1 | Calculate the length of the curve. |
| ExtendPointOnLine | 1 | Return a new point, p3, which is on the same line as p1 and p2, but dist away from p2. |
| SubdivideCurve | 1 | Break up long segments in the curve into smaller segments of len maxLen or smaller. |
| RebalanceCurve | 1 | Redraw the curve using numPoints points equally spaced along the length of the curve. |
| RotateCurve | 1 | Rotate the curve around the origin. |
03 Members
IList(Of Double))Sums all elements in a list of numbers.
IList(Of Double))Calculates the average of a list of numbers.
Point, Point)Subtracts point v2 from v1.
Point)Calculates the magnitude (length) of a vector from the origin.
Discrete Frechet distance between 2 curves. Based on http://www.kr.tuwien.ac.at/staff/eiter/et-archive/cdtr9464.pdf Modified to be iterative and have better memory usage.
Estimate how similar the shapes of 2 curves are to each other, accounting for translation, scale, and rotation.
| Name | Type | Description |
|---|---|---|
curve1 | Curve | The first curve. |
curve2 | Curve | The second curve. |
options | ShapeSimilarityOpts | Options for the similarity calculation. |
A value between 1 and 0 depending on how similar the shapes are, where 1 means identical.
Translate and scale curve by Procrustes Analysis. Optionally runs RebalanceCurve first (default true). From https://en.wikipedia.org/wiki/Procrustes_analysis
| Name | Type | Description |
|---|---|---|
curve | Curve | The curve to normalize. |
options | ProcrustesNormalizeCurveOpts | Options for normalization. |
The normalized curve.
Find the angle to rotate curve to match the rotation of relativeCurve using procrustes analysis. From https://en.wikipedia.org/wiki/Procrustes_analysis curve and relativeCurve must have the same number of points. curve and relativeCurve should both be run through ProcrustesNormalizeCurve first.
| Name | Type | Description |
|---|---|---|
curve | Curve | The curve to rotate. |
relativeCurve | Curve | The curve to match rotation with. |
The rotation angle in radians.
Rotate curve to match the rotation of relativeCurve using procrustes analysis. From https://en.wikipedia.org/wiki/Procrustes_analysis curve and relativeCurve must have the same number of points. curve and relativeCurve should both be run through ProcrustesNormalizeCurve first.
| Name | Type | Description |
|---|---|---|
curve | Curve | The curve to rotate. |
relativeCurve | Curve | The curve to match rotation with. |
The rotated curve.
Point, Point)Calculate the distance between 2 points.
| Name | Type | Description |
|---|---|---|
point1 | Point | The first point. |
point2 | Point | The second point. |
The Euclidean distance.
Calculate the length of the curve.
| Name | Type | Description |
|---|---|---|
points | Curve | The curve as a list of points. |
The total length of the curve.
Point, Point, Double)Return a new point, p3, which is on the same line as p1 and p2, but dist away from p2. p1, p2, p3 will always lie on the line in that order (as long as dist is positive).
| Name | Type | Description |
|---|---|---|
p1 | Point | The first point defining the line. |
p2 | Point | The second point defining the line. |
dist | Double | The distance from p2 to the new point. |
The new point.
Break up long segments in the curve into smaller segments of len maxLen or smaller.
| Name | Type | Description |
|---|---|---|
curve | Curve | The input curve. |
options | SubdivideCurveOpts | Options for subdivision. |
The subdivided curve.
Redraw the curve using numPoints points equally spaced along the length of the curve. This may result in a slightly different shape than the original if numPoints is low.
| Name | Type | Description |
|---|---|---|
curve | Curve | The input curve. |
options | RebalanceCurveOpts | Options for rebalancing. |
The rebalanced curve.
Double)Rotate the curve around the origin.
| Name | Type | Description |
|---|---|---|
curve | Curve | The curve to rotate. |
theta | Double | The angle to rotate by, in radians. |
The rotated curve.