Table of Contents

Constructor GeoSpline3

Namespace
GeometryHelper.Geometry
Assembly
GeometryHelper.dll

GeoSpline3(int, IEnumerable<GeoPoint3>, IEnumerable<double>, IEnumerable<double>)

Initializes a spline from its degree, control points and knots, and its weights if it is rational.

public GeoSpline3(int degree, IEnumerable<GeoPoint3> controlPoints, IEnumerable<double> knots, IEnumerable<double> weights = null)

Parameters

degree int

The degree, from 1 to 25: 1 for straight pieces, 2 for the conics of an arc, 3 for the cubics that draughtsmen and AutoCAD use.

controlPoints IEnumerable<GeoPoint3>

The control points, at least degree + 1 and not all one point.

knots IEnumerable<double>

The knots, controlPoints + degree + 1 of them, not decreasing; the first degree + 1 equal and the last degree + 1 equal and above them, and no inner knot repeated more than degree times.

weights IEnumerable<double>

The weights, one for each control point and above nought, or null for all of them one, and no more than 1E12 to one apart (past that the length cannot be worked out right). All one is a plain B-spline, which IsRational says.

Remarks

The numbers are copied, and kept as they are: nothing is rescaled or reordered. A spline of degree 3 with four control points takes the knots 0, 0, 0, 0, 1, 1, 1, 1; with a fifth it takes nine knots, such as 0, 0, 0, 0, 0.5, 1, 1, 1, 1.

Exceptions

ArgumentNullException

Thrown when the control points or the knots are null.

ArgumentOutOfRangeException

Thrown when the degree is outside 1 to 25, a weight is not a positive number, or the largest weight is more than 1E12 times the smallest.

ArgumentException

Thrown when there are too few control points, a point or a knot is not a finite number, the knots are the wrong number or not clamped, or the control points are all one point.