Table of Contents

Method Interpolate

Namespace
GeometryHelper.Geometry
Assembly
GeometryHelper.dll

Interpolate(IEnumerable<GeoPoint3>, int)

Builds the spline that passes through a list of fit points, as AutoCAD's fit-point splines do, with the curve left to settle its own direction at each end.

public static GeoSpline3 Interpolate(IEnumerable<GeoPoint3> fitPoints, int degree = 3)

Parameters

fitPoints IEnumerable<GeoPoint3>

The points to pass through, in order; at least degree + 1 once the ones that coincide are dropped.

degree int

The degree, from 1 to 25, and at most one less than the number of points; 3 if not given.

Returns

GeoSpline3

The spline, not rational, over [0, 1].

Remarks

The method is global interpolation with chord-length parameters (Piegl and Tiller, The NURBS Book, 9.2.1). Each fit point is given a parameter equal to the share of the length of the chain through the points that comes before it, so that the points are met at parameters in proportion to how far apart they are; the inner knots are the averages of degree of those parameters in a row; and the control points are what makes the curve meet every fit point, found by solving one banded system, which costs the same for each point however many there are.

A fit point within the point tolerance of the one before it is dropped, as a polyline drops a vertex, since two points the same make parameters the same and a system that cannot be solved.

Exceptions

ArgumentNullException

Thrown when the points are null.

ArgumentOutOfRangeException

Thrown when the degree is outside 1 to 25.

ArgumentException

Thrown when a point is not a finite point, or there are fewer than degree + 1 distinct points.

Interpolate(IEnumerable<GeoPoint3>, int, Tolerance)

Builds the spline that passes through a list of fit points, within a tolerance that decides which neighbouring fit points are one point.

public static GeoSpline3 Interpolate(IEnumerable<GeoPoint3> fitPoints, int degree, Tolerance tolerance)

Parameters

fitPoints IEnumerable<GeoPoint3>

The points to pass through, in order; at least degree + 1 once the ones that coincide are dropped.

degree int

The degree, from 1 to 25, and at most one less than the number of points.

tolerance Tolerance

The tolerance: a fit point within its point tolerance of the one kept before it is dropped.

Returns

GeoSpline3

The spline, not rational, over [0, 1].

Remarks

See Interpolate(IEnumerable<GeoPoint3>, int). Points just above the tolerance are kept, and the chord lengths the parameters come from are then tiny beside the rest, so the curve can swing far between them, by hundreds of thousands where the chain turns, as it can in the plane (see Interpolate(IEnumerable<GeoPoint2>, int, Tolerance)). Drop such points before asking, or give a tolerance that does.

Exceptions

ArgumentNullException

Thrown when the points are null.

ArgumentOutOfRangeException

Thrown when the degree is outside 1 to 25.

ArgumentException

Thrown when a point is not a finite point, or there are fewer than degree + 1 distinct points.

Interpolate(IEnumerable<GeoPoint3>, GeoVector3, GeoVector3, int)

Builds the spline that passes through a list of fit points and leaves the first and arrives at the last in given directions.

public static GeoSpline3 Interpolate(IEnumerable<GeoPoint3> fitPoints, GeoVector3 startTangent, GeoVector3 endTangent, int degree = 3)

Parameters

fitPoints IEnumerable<GeoPoint3>

The points to pass through, in order; at least two once the ones that coincide are dropped.

startTangent GeoVector3

The direction at the first point; its length does not matter, and it may not be nought.

endTangent GeoVector3

The direction at the last point; its length does not matter, and it may not be nought.

degree int

The degree, from 2 to 25, and at most one more than the number of points; 3 if not given.

Returns

GeoSpline3

The spline, not rational, over [0, 1].

Remarks

As Interpolate(IEnumerable<GeoPoint3>, int), with the two end conditions added to the system: the curve has two more control points. A tangent gives a direction and nothing else: the curve leaves and arrives at the speed it keeps on average, which over [0, 1] is the length of the chain through the fit points, so that three points 100 apart along X with the tangent (1, 0, 0) at each end give the straight line through them, run at an even speed of 200, and a tangent of any other length gives the same curve.

Exceptions

ArgumentNullException

Thrown when the points are null.

ArgumentOutOfRangeException

Thrown when the degree is outside 2 to 25.

ArgumentException

Thrown when a point or a tangent is not finite, a tangent has no length, or there are too few distinct points for the degree.

Interpolate(IEnumerable<GeoPoint3>, GeoVector3, GeoVector3, int, Tolerance)

Builds the spline that passes through a list of fit points and leaves the first and arrives at the last in given directions, within a tolerance that decides which neighbouring fit points are one point.

public static GeoSpline3 Interpolate(IEnumerable<GeoPoint3> fitPoints, GeoVector3 startTangent, GeoVector3 endTangent, int degree, Tolerance tolerance)

Parameters

fitPoints IEnumerable<GeoPoint3>

The points to pass through, in order; at least two once the ones that coincide are dropped.

startTangent GeoVector3

The direction at the first point; its length does not matter, and it may not be nought.

endTangent GeoVector3

The direction at the last point; its length does not matter, and it may not be nought.

degree int

The degree, from 2 to 25, and at most one more than the number of points.

tolerance Tolerance

The tolerance: a fit point within its point tolerance of the one kept before it is dropped.

Returns

GeoSpline3

The spline, not rational, over [0, 1].

Remarks

Exceptions

ArgumentNullException

Thrown when the points are null.

ArgumentOutOfRangeException

Thrown when the degree is outside 2 to 25.

ArgumentException

Thrown when a point or a tangent is not finite, a tangent has no length, or there are too few distinct points for the degree.