Namespace for collection of 2D curve functions from the Foundation package. More...
Classes | |
class | AlignmentConfiguration |
A set of parameters that configures an alignment operation. More... | |
class | AlignmentResult2D |
A set of parameters that stores the result of alignment operation. More... | |
Enumerations | |
enum class | PreAlignmentMode { Off , On } |
Specifies if the pre-alignment is required. More... | |
enum class | StartSelectionMode { AsIs , Best } |
Decides which start point should be used for the new curve. More... | |
Functions | |
std::vector< Point2D< double > > | ResampleCurve (const std::vector< Point2D< double > > &curve, int resampledCurveLength) |
Resamples a 2-dimensional curve via linear interpolation assuming that the "speed" of the time mapping is constant. More... | |
AlignmentResult2D | AlignCurve (const std::vector< Point2D< double > > &curve, const std::vector< Point2D< double > > &curveToBeAligned, const AlignmentConfiguration &config=AlignmentConfiguration()) |
Aligns two 2D curves via an iterative closest point method considering consensus correspondence for better shape alignment. More... | |
std::vector< double > | CalculateSignedDifferences (const std::vector< Point2D< double > > &curve, const std::vector< Point2D< double > > &points) |
Calculates signed differences along the y axis of given points to curve (curve - points). More... | |
std::vector< Point2D< double > > | IntersectWithLine (const std::vector< Point2D< double > > &curve, const Line2D &line) |
Intersects a 2D curve with a line. More... | |
double | CalculateEnclosedArea (const std::vector< Point2D< double > > &curve) |
Calculates the enclosed area of the given curve. More... | |
Matrix2D | CalculateQuadraticDifferencesToClosestPoint (const std::vector< Point2D< double > > &curve, const std::vector< Point2D< double > > &points) |
Calculates the quadratic distance of the points to the closest point of the given curve. More... | |
std::vector< Point2D< double > > | MergeTwoCurves (const std::vector< Point2D< double > > &curveLHS, const std::vector< Point2D< double > > &curveRHS, const StartSelectionMode &mode) |
Merges two curves into one curve with interpolation. More... | |
Namespace for collection of 2D curve functions from the Foundation package.
|
strong |
|
strong |
|
inline |
Aligns two 2D curves via an iterative closest point method considering consensus correspondence for better shape alignment.
[in] | curve | Reference curve. |
[in] | curveToBeAligned | Curve to be aligned to curve. |
[in] | config | Configuration of alignment. |
Any | exception derived from std::exception including CvbException. |
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.
|
inline |
Calculates the enclosed area of the given curve.
[in] | curve | Curve. |
Any | exception derived from std::exception including CvbException. |
Uses the shoelace algorithm to calculate the enclosed area of the given curve. All points are assumed to be in order, clockwise or anti clockwise 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.
|
inline |
Calculates the quadratic distance of the points to the closest point of the given curve.
[in] | curve | Curve. |
[in] | points | Points. |
Any | exception derived from std::exception including CvbException. |
For the calculation of the signed differences the curve is assumed to be infinite. It is extended at the starting and endpoint.
|
inline |
Calculates signed differences along the y axis of given points to curve (curve - points).
[in] | curve | Curve. |
[in] | points | Points. |
Any | exception derived from std::exception including CvbException. |
For the calculation of the signed differences the curve is assumed to be infinite. It is extended at the starting and endpoint.
|
inline |
Intersects a 2D curve with a line.
[in] | curve | Curve to be intersected. |
[in] | line | Line to intersect with. |
Any | exception derived from std::exception including CvbException. |
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.
|
inline |
Merges two curves into one curve with interpolation.
[in] | curveLHS | Left hand side curve. This curve is assumed starting point if sorting is executed. |
[in] | curveRHS | Right hand side curve. |
[in] | mode | Specifies if left and right order of the two curves is to be found by the algorithm. |
Any | exception derived from std::exception including CvbException. |
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 sorting is executed, then the pair of curves curveLHS and curveRHS 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.
|
inline |
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] | resampledCurveLength | Length of the resulting curve. |
Any | exception derived from std::exception including CvbException. |