Export of 2D curve functions. More...
Data Structures | |
struct | CVFAlignment2DResult |
struct | CVFAlignmentConfiguration |
Functions | |
cvbres_t | CVFAlignCurves2D (const CVIPointD *Curve, cvbdim_t CurveLength, const CVIPointD *CurveToBeAligned, cvbdim_t CurveToBeAlignedLength, const CVFAlignmentConfiguration &Config, CVFAlignment2DResult &Result) |
Aligns two 2D curves via an iterative closest point method considering consensus correspondence for better shape alignment. More... | |
cvbres_t | CVFCalculateEnclosedArea (const CVIPointD *Curve, cvbdim_t CurveLength, double *EnclosedArea) |
Calculates the enclosed area of the given curve. More... | |
cvbres_t | CVFCalculateQuadraticDifferencesToClosestPoint (const CVIPointD *Curve, cvbdim_t CurveLength, const CVIPointD *Points, cvbdim_t PointsLength, double *Differences) |
Calculates the quadratic distance of Points to closest point of given Curve (Points of Curve - Points). More... | |
cvbres_t | CVFCalculateSignedDifferences (const CVIPointD *Curve, cvbdim_t CurveLength, const CVIPointD *Points, cvbdim_t PointsLength, double *SignedDifferences) |
Calculates signed differences along the y axis of given points to curve (Curve - Points). More... | |
cvbres_t | CVFIntersectCurve2DWithLine (const CVIPointD *Curve, cvbdim_t CurveLength, CVIPointD Normal, double DistanceToOrigin, cvbdim_t IntersectionPointsLength, CVIPointD *IntersectionPoints, cvbdim_t &IntersectionPointsCalculatedLength) |
Intersects a 2D curve with a line. More... | |
cvbres_t | CVFMerge2Curves (const CVIPointD *CurveLHS, cvbdim_t CurveLengthLHS, const CVIPointD *CurveRHS, cvbdim_t CurveLengthRHS, cvbbool_t sort, cvbdim_t CurveOutAllocatedLength, CVIPointD *CurveOut, cvbdim_t &CurveOutLength) |
Merges two curves into one curve with interpolation. More... | |
cvbres_t | CVFResampleCurve2D (const CVIPointD *Curve, cvbdim_t CurveLength, cvbdim_t ResampledCurveLength, CVIPointD *ResampledCurve) |
Resamples a 2-dimensional curve via linear interpolation assuming that the "speed" of the time mapping is constant. More... | |
Export of 2D curve functions.
cvbres_t CVFAlignCurves2D | ( | const CVIPointD * | Curve, |
cvbdim_t | CurveLength, | ||
const CVIPointD * | CurveToBeAligned, | ||
cvbdim_t | CurveToBeAlignedLength, | ||
const CVFAlignmentConfiguration & | Config, | ||
CVFAlignment2DResult & | Result | ||
) |
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 (iterative closest 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 performed by finding correspondences solely based on nearest neighbours without any feasibility check.
[in] | Curve | Reference curve. |
[in] | CurveLength | Length of Curve. |
[in] | CurveToBeAligned | Curve to be aligned to Curve. |
[in] | CurveToBeAlignedLength | Length of CurveToBeAligned. |
[in] | Config | Configuration of alignment. |
[out] | Result | Alignment result. |
cvbres_t CVFCalculateEnclosedArea | ( | const CVIPointD * | Curve, |
cvbdim_t | CurveLength, | ||
double * | EnclosedArea | ||
) |
Calculates the enclosed area of the given curve.
Uses the shoelace algorithm to calculate the enclosed area of the given curve. All points are assumed to be in order, clockwise or anticlockwise will not affect the outcome. This algorithm can only handle not self intersecting curves, e.g. a figure eight curve will not work with this algorithm.
For numerical stabilization all points are shifted to be centered around the origin.
If the curve is not closed, i.e. the first and last point in the given point set don't match, the curve is closed automatically by connecting the first and last point.
[in] | Curve | Curve. |
[in] | CurveLength | Length of Curve. |
[out] | EnclosedArea | The enclosed of the given Curve as double. |
cvbres_t CVFCalculateQuadraticDifferencesToClosestPoint | ( | const CVIPointD * | Curve, |
cvbdim_t | CurveLength, | ||
const CVIPointD * | Points, | ||
cvbdim_t | PointsLength, | ||
double * | Differences | ||
) |
Calculates the quadratic distance of Points to closest point of given Curve (Points of Curve - Points).
For the calculation of the signed differences the curve is assumed to be infinite. It is extended at the starting and endpoint.
[in] | Curve | Curve. |
[in] | CurveLength | Length of Curve. |
[in] | Points | Points. |
[in] | PointsLength | Length of Points. |
[out] | Differences | Array of length PointsLength to receive differences. |
cvbres_t CVFCalculateSignedDifferences | ( | const CVIPointD * | Curve, |
cvbdim_t | CurveLength, | ||
const CVIPointD * | Points, | ||
cvbdim_t | PointsLength, | ||
double * | SignedDifferences | ||
) |
Calculates signed differences along the y axis of given points to curve (Curve - Points).
For the calculation of the signed differences the curve is assumed to be infinite. It is extended at the starting and endpoint.
[in] | Curve | Curve. |
[in] | CurveLength | Length of Curve. |
[in] | Points | Points. |
[in] | PointsLength | Length of Points. |
[out] | SignedDifferences | Array of length PointsLength to receive signed differences. |
cvbres_t CVFIntersectCurve2DWithLine | ( | const CVIPointD * | Curve, |
cvbdim_t | CurveLength, | ||
CVIPointD | Normal, | ||
double | DistanceToOrigin, | ||
cvbdim_t | IntersectionPointsLength, | ||
CVIPointD * | IntersectionPoints, | ||
cvbdim_t & | IntersectionPointsCalculatedLength | ||
) |
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 curve is finite. It starts and ends at the first and last point respectively.
[in] | Curve | Curve to be intersected. |
[in] | CurveLength | Length of Curve. |
[in] | Normal | Normal of line (Hessian normal form). |
[in] | DistanceToOrigin | Distance of line to origin (Hessian normal form). |
[in] | IntersectionPointsLength | Length of IntersetionPoints allocated by the caller. |
[out] | IntersectionPoints | Array which receives calculated intersection points. |
[out] | IntersectionPointsCalculatedLength | Number of calculated intersection points. |
cvbres_t CVFMerge2Curves | ( | const CVIPointD * | CurveLHS, |
cvbdim_t | CurveLengthLHS, | ||
const CVIPointD * | CurveRHS, | ||
cvbdim_t | CurveLengthRHS, | ||
cvbbool_t | sort, | ||
cvbdim_t | CurveOutAllocatedLength, | ||
CVIPointD * | CurveOut, | ||
cvbdim_t & | CurveOutLength | ||
) |
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 CurveRHS to CurveLHS.
This method works with curves in 2D.
If sort is set true, then the best starting point of the two possible starting points (each of the given curve statrint points is a valid choice). 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.
[in] | CurveLHS | Left hand side curve. This curve is assumed starting point if sort is false. |
[in] | CurveLengthLHS | Length of CurveLHS. |
[in] | CurveRHS | right hand side curve |
[in] | CurveLengthRHS | Length of CurveRHS |
[in] | sort | Boolean to decide if left and right order of the two curves is to be found by the algorithm. |
[in] | CurveOutAllocatedLength | Length of CurveOut allocated by the caller. The maximum possible length of a merged curve is the sum of lengths of both input curves, the minimum length is the maximum length of both input curves. |
[out] | CurveOut | Merged curve |
[out] | CurveOutLength | length of the merged curve |
cvbres_t CVFResampleCurve2D | ( | const CVIPointD * | Curve, |
cvbdim_t | CurveLength, | ||
cvbdim_t | ResampledCurveLength, | ||
CVIPointD * | ResampledCurve | ||
) |
Resamples a 2-dimensional curve via linear interpolation assuming that the "speed" of the time mapping is constant.
[in] | Curve | Curve to be resampled. |
[in] | CurveLength | Length of Curve. |
[in] | ResampledCurveLength | Length of ResampledCurve. |
[out] | ResampledCurve | Array of length ResampledCurveLength to receive resampled curve. |