CVB.Net 14.0
CurveExtensions Class Reference

Extension methods for a curve (Point2Dd array). More...

Static Public Member Functions

static double[] SignedDifferences (this Point2Dd[] curve, Point2Dd[] points)
 Calculates signed differences along the y axis of given points to curve (Curve - Points). More...
 
static double[] QuadraticDifferencesToClosestPoint (this Point2Dd[] curve, Point2Dd[] points)
 Calculates the quadratic distance of points to closest point of given curve (Points of curve - points ). More...
 
static double EnclosedArea (this Point2Dd[] curve)
 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, clock - wise or anti clock - wise 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. More...
 

Detailed Description

Extension methods for a curve (Point2Dd array).

Member Function Documentation

◆ EnclosedArea()

static double EnclosedArea ( this Point2Dd[]  curve)
static

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, clock - wise or anti clock - wise 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.

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
curveThe curve whose enclosed area to calculate.
Returns
The enclosed area of the given curve as double.
Exceptions
ArgumentNullExceptionWhen curve is null.
ArgumentExceptionWhen curve contains less than 2 points.
CvbExceptionWhen an error during calculation occurs.

◆ QuadraticDifferencesToClosestPoint()

static double[] QuadraticDifferencesToClosestPoint ( this Point2Dd[]  curve,
Point2Dd[]  points 
)
static

Calculates the quadratic distance of points to closest point of given curve (Points of curve - points ).

The points have to be ordered by time, i.e. two consecutive points must adjoin another on the curve.

For the calculation of the signed differences the curve is assumed to be infinite. It is extended at the starting and endpoint.

Parameters
curveThe curve.
pointsThe points.
Returns
The calculated quadratic differences.
Exceptions
ArgumentNullExceptionWhen curve or points is null.
ArgumentExceptionWhen curve contains less than 2 points or points contains less than 1 point.
CvbExceptionWhen an error during calculation occurs.

◆ SignedDifferences()

static double[] SignedDifferences ( this Point2Dd[]  curve,
Point2Dd[]  points 
)
static

Calculates signed differences along the y axis of given points to curve (Curve - Points).

The points have to be ordered by ascending x coordinates.

Parameters
curveThe curve.
pointsThe points.
Returns
The signed differences.
Exceptions
ArgumentNullExceptionWhen curve or points is null.
ArgumentExceptionWhen curve contains less than 2 points or points contains less than 1 point.
CvbExceptionWhen an error during calculation occurs.