Constructor GeoSpline2
- Namespace
- GeometryHelper.Geometry
- Assembly
- GeometryHelper.dll
GeoSpline2(int, IEnumerable<GeoPoint2>, IEnumerable<double>, IEnumerable<double>)
Initializes a spline from its degree, control points and knots, and its weights if it is rational.
public GeoSpline2(int degree, IEnumerable<GeoPoint2> controlPoints, IEnumerable<double> knots, IEnumerable<double> weights = null)
Parameters
degreeintThe 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.
controlPointsIEnumerable<GeoPoint2>The control points, at least degree + 1 and not all one point.
knotsIEnumerable<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.
weightsIEnumerable<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 the control points (0, 0), (100, 150), (200, 150), (300, 0) takes the knots 0, 0, 0, 0, 1, 1, 1, 1; with a fifth control point 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.