CVB.Net 14.0
Curve Class Reference

2D curve functions. More...

Static Public Member Functions

static Point2Dd[] Resample (Point2Dd[] curve, int resampledCurveLength)
 Resamples a 2-dimensional curve via linear interpolation assuming that the "speed" of the time mapping is constant. More...
 
static Point2Dd[] IntersectWithLine (Point2Dd[] curve, Line line)
 Intersects a 2D curve with a line. More...
 
static Alignment2DResult Align (Point2Dd[] curve, Point2Dd[] curveToBeAligned, AlignmentSettings config)
 Aligns two 2D curves via an iterative closest point method considering consensus correspondence for better shape alignment. More...
 
static Point2Dd[] Merge (Point2Dd[] curve1, Point2Dd[] curve2, StartSelection startSelection)
 Merges two curves into one curve with interpolation. Takes two curves and merges them into one combined curve. If they overlap, an interpolation method is used to find a suitable approximation. This interpolation is done when switching between the two curves while the points are interleaved. The order in which the points are interleaved is defined by the closest neighbour for each point from curve2 to curve1 . More...
 

Detailed Description

2D curve functions.

Member Function Documentation

◆ Align()

static Alignment2DResult Align ( Point2Dd[]  curve,
Point2Dd[]  curveToBeAligned,
AlignmentSettings  config 
)
static

Aligns two 2D curves via an iterative closest point method considering consensus correspondence for better shape alignment.

The method used here is a version of the ICP (closest iterative point) method. It uses a consensus metric to find the correspondence between points to stabilize the iterations needed in the alignment method. It supports only rigid transformations for the alignment. If not enough points within a given consens are found a classical ICP step is perfomed by finding corresponences soley based on nearest neighbours without any feasibility check.

Parameters
curveReference curve.
curveToBeAlignedCurve to be aligned to curve .
configConfiguration of alignment.
Returns
Alignment result.
Exceptions
ArgumentNullExceptionWhen curve or curveToBeAligned is null.
ArgumentExceptionWhen curve or curveToBeAligned is empty.
CvbExceptionWhen an error during alignment occurs.

◆ IntersectWithLine()

static Point2Dd[] IntersectWithLine ( Point2Dd[]  curve,
Line  line 
)
static

Intersects a 2D curve with a line.

The line is defined by the hessian normal form: normal * x = d, with normal = 1 and d > 0.

The points have to be ordered by ascending x coordinates.

Parameters
curveCurve to be intersected.
lineLine to interesect with.
Returns
Intersection points.
Exceptions
ArgumentNullExceptionWhen curve is null.
ArgumentExceptionWhen curve is empty.
CvbExceptionWhen an error during intersecting occurs.

◆ Merge()

static Point2Dd[] Merge ( Point2Dd[]  curve1,
Point2Dd[]  curve2,
StartSelection  startSelection 
)
static

Merges two curves into one curve with interpolation. Takes two curves and merges them into one combined curve. If they overlap, an interpolation method is used to find a suitable approximation. This interpolation is done when switching between the two curves while the points are interleaved. The order in which the points are interleaved is defined by the closest neighbour for each point from curve2 to curve1 .

This method works with curves in 2D.

If startSelection is set to StartSelection.Best, then the pair of curves curve1 and curve2 are sorted from left to right. This means, the algorithm checks which starting point from the two staring points is the best starting point for the merged curve. To make this decision the distance from each possible starting point to the other given curve is calculated and the point with the highest distance is taken as the overall starting point for the new generated merged curve. This method does work well for regular curves (not self intercepting curves). It can be switched off to save computation time if the caller is sure about the correct order.

The points on the curve are evaluated in the order in which they are listed. We assume a ordered pointset (not ordered by axis, but ordered according to the curve).

Parameters
curve1First curve to merge.
curve2Second curve to merge.
startSelectionWhich start point to use for the new curve.
Returns
Merged curve.
Exceptions
ArgumentNullExceptionWhen curve1 or curve2 is null.
ArgumentExceptionWhen curve1 or curve2 do not contain points.
CvbExceptionWhen an error during merging occurs.

◆ Resample()

static Point2Dd[] Resample ( Point2Dd[]  curve,
int  resampledCurveLength 
)
static

Resamples a 2-dimensional curve via linear interpolation assuming that the "speed" of the time mapping is constant.

The points have to be ordered by ascending x coordinates.

Parameters
curveCurve to be resampled.
resampledCurveLengthLength of the resulting curve.
Returns
Resampled curve.
Exceptions
ArgumentNullExceptionWhen curve is null.
ArgumentExceptionWhen curve is empty.
ArgumentOutOfRangeExceptionWhen resampledCurveLength is > 1.
CvbExceptionWhen an error during resampling occurs.