Generated by DocFX

Class KnotVector

The Knot Vector is a sequence of parameter values that determines where and how the control points affect the NURBS curve.
The number of knot vector is always equal to the number of control points plus curve degree plus one (i.e. number of control points plus curve order).

Inheritance
System.Object
System.Collections.Generic.List<System.Double>
KnotVector
Inherited Members
System.Collections.Generic.List<System.Double>.System.Collections.IList.get_Item(System.Int32)
System.Collections.Generic.List<System.Double>.System.Collections.IList.set_Item(System.Int32, System.Object)
System.Collections.Generic.List<System.Double>.Add(System.Double)
System.Collections.Generic.List<System.Double>.AddRange(System.Collections.Generic.IEnumerable<System.Double>)
System.Collections.Generic.List<System.Double>.AsReadOnly()
System.Collections.Generic.List<System.Double>.BinarySearch(System.Int32, System.Int32, System.Double, System.Collections.Generic.IComparer<System.Double>)
System.Collections.Generic.List<System.Double>.BinarySearch(System.Double)
System.Collections.Generic.List<System.Double>.BinarySearch(System.Double, System.Collections.Generic.IComparer<System.Double>)
System.Collections.Generic.List<System.Double>.Clear()
System.Collections.Generic.List<System.Double>.Contains(System.Double)
System.Collections.Generic.List<System.Double>.ConvertAll<TOutput>(System.Converter<System.Double, TOutput>)
System.Collections.Generic.List<System.Double>.CopyTo(System.Int32, System.Double[], System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.CopyTo(System.Double[])
System.Collections.Generic.List<System.Double>.CopyTo(System.Double[], System.Int32)
System.Collections.Generic.List<System.Double>.Exists(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.Find(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindAll(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindIndex(System.Int32, System.Int32, System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindIndex(System.Int32, System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindIndex(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindLast(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindLastIndex(System.Int32, System.Int32, System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindLastIndex(System.Int32, System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.FindLastIndex(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.ForEach(System.Action<System.Double>)
System.Collections.Generic.List<System.Double>.GetEnumerator()
System.Collections.Generic.List<System.Double>.GetRange(System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.IndexOf(System.Double)
System.Collections.Generic.List<System.Double>.IndexOf(System.Double, System.Int32)
System.Collections.Generic.List<System.Double>.IndexOf(System.Double, System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.Insert(System.Int32, System.Double)
System.Collections.Generic.List<System.Double>.InsertRange(System.Int32, System.Collections.Generic.IEnumerable<System.Double>)
System.Collections.Generic.List<System.Double>.LastIndexOf(System.Double)
System.Collections.Generic.List<System.Double>.LastIndexOf(System.Double, System.Int32)
System.Collections.Generic.List<System.Double>.LastIndexOf(System.Double, System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.Remove(System.Double)
System.Collections.Generic.List<System.Double>.RemoveAll(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.RemoveAt(System.Int32)
System.Collections.Generic.List<System.Double>.RemoveRange(System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.Reverse()
System.Collections.Generic.List<System.Double>.Reverse(System.Int32, System.Int32)
System.Collections.Generic.List<System.Double>.Sort()
System.Collections.Generic.List<System.Double>.Sort(System.Collections.Generic.IComparer<System.Double>)
System.Collections.Generic.List<System.Double>.Sort(System.Comparison<System.Double>)
System.Collections.Generic.List<System.Double>.Sort(System.Int32, System.Int32, System.Collections.Generic.IComparer<System.Double>)
System.Collections.Generic.List<System.Double>.System.Collections.Generic.IEnumerable<System.Double>.GetEnumerator()
System.Collections.Generic.List<System.Double>.System.Collections.ICollection.CopyTo(System.Array, System.Int32)
System.Collections.Generic.List<System.Double>.System.Collections.IEnumerable.GetEnumerator()
System.Collections.Generic.List<System.Double>.System.Collections.IList.Add(System.Object)
System.Collections.Generic.List<System.Double>.System.Collections.IList.Contains(System.Object)
System.Collections.Generic.List<System.Double>.System.Collections.IList.IndexOf(System.Object)
System.Collections.Generic.List<System.Double>.System.Collections.IList.Insert(System.Int32, System.Object)
System.Collections.Generic.List<System.Double>.System.Collections.IList.Remove(System.Object)
System.Collections.Generic.List<System.Double>.ToArray()
System.Collections.Generic.List<System.Double>.TrimExcess()
System.Collections.Generic.List<System.Double>.TrueForAll(System.Predicate<System.Double>)
System.Collections.Generic.List<System.Double>.Capacity
System.Collections.Generic.List<System.Double>.Count
System.Collections.Generic.List<System.Double>.Item[System.Int32]
System.Collections.Generic.List<System.Double>.System.Collections.Generic.ICollection<System.Double>.IsReadOnly
System.Collections.Generic.List<System.Double>.System.Collections.ICollection.IsSynchronized
System.Collections.Generic.List<System.Double>.System.Collections.ICollection.SyncRoot
System.Collections.Generic.List<System.Double>.System.Collections.IList.IsFixedSize
System.Collections.Generic.List<System.Double>.System.Collections.IList.IsReadOnly
System.Collections.Generic.List<System.Double>.System.Collections.IList.Item[System.Int32]
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Syntax
public class KnotVector : List<double>, IList<double>, ICollection<double>, IReadOnlyList<double>, IReadOnlyCollection<double>, IEnumerable<double>, IList, ICollection, IEnumerable

Constructors

| Improve this Doc View Source

KnotVector()

Default constructor.

Declaration
public KnotVector()
| Improve this Doc View Source

KnotVector(IEnumerable<Double>)

Creates an instance of the knot vector from a list of double values.

Declaration
public KnotVector(IEnumerable<double> values)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Double> values

Set of knots.

| Improve this Doc View Source

KnotVector(Int32, Int32, Boolean)

Creates an instance of the knot vector given degree, number of control points and whether it is clamped or unclamped.

Declaration
public KnotVector(int degree, int numberOfControlPts, bool clamped = true)
Parameters
Type Name Description
System.Int32 degree

Degree of the curve.

System.Int32 numberOfControlPts

Number of control points of the curve.

System.Boolean clamped

If the curve is clamped or not.

Methods

| Improve this Doc View Source

Copy()

Creates a copy of the knotVector.

Declaration
public KnotVector Copy()
Returns
Type Description
KnotVector

The copy of the knotVector.

| Improve this Doc View Source

GetDomain(Int32)

Gets the domain of the knot vector.

Declaration
public Interval GetDomain(int degree)
Parameters
Type Name Description
System.Int32 degree

The degree of the curve.

Returns
Type Description
Interval

The domain.

| Improve this Doc View Source

IsClamped(Int32)

Checks if the knot is clamped, so if they are in the following structure.
[ (degree + 1 copies of the first knot), internal non-decreasing knots, (degree + 1 copies of the last knot) ].

Declaration
public bool IsClamped(int degree)
Parameters
Type Name Description
System.Int32 degree

Curve degree.

Returns
Type Description
System.Boolean

If true the knot is clamped, if false is unclamped.

| Improve this Doc View Source

IsPeriodic(Int32)

Checks if the knot is periodic, so if they are in the following structure.
[ (degree, negative values), internal non-decreasing knots between 0 and 1, (degree, positive values bigger than 1.0) ].

Declaration
public bool IsPeriodic(int degree)
Parameters
Type Name Description
System.Int32 degree
Returns
Type Description
System.Boolean

If true the knot is periodic, if false is clamped or unclamped.

| Improve this Doc View Source

IsValid(Int32, Int32)

Checks the validity of the input knot vector.
Confirm the relations between degree (p), number of control points(n+1), and the number of knots (m+1).
Refer to The NURBS Book (2nd Edition), p.50 for details.

More specifically, this method checks if the knot vector is of the following structure:
The knot knots must be non-decreasing and of length (degree + 1) * 2 or greater

Declaration
public bool IsValid(int degree, int numberOfControlPts)
Parameters
Type Name Description
System.Int32 degree

The degree of the curve.

System.Int32 numberOfControlPts
Returns
Type Description
System.Boolean

Whether the knots are valid.

| Improve this Doc View Source

Multiplicities()

Returns the multiplicity values of the all knots in this knot vector.

Declaration
public Dictionary<double, int> Multiplicities()
Returns
Type Description
System.Collections.Generic.Dictionary<System.Double, System.Int32>

Dictionary of [knot, multiplicity].

| Improve this Doc View Source

Multiplicity(Double)

Calculates the multiplicity of a knot.

Declaration
public int Multiplicity(double knot)
Parameters
Type Name Description
System.Double knot

The index of the knot to determine multiplicity.

Returns
Type Description
System.Int32

The multiplicity of the knot, or 0 if the knot is not part of the knot vector.

| Improve this Doc View Source

Normalize()

Normalizes the input knot vector to a range from 0.0 to 1.0.

Declaration
public KnotVector Normalize()
Returns
Type Description
KnotVector

Normalized knots vector.

| Improve this Doc View Source

Refine(NurbsBase, IList<Double>)

Performs a knot refinement on a curve, inserting knots and updating the control point locations.
Implementation of Algorithm A5.4 of The NURBS Book by Piegl and Tiller.

Declaration
public static NurbsBase Refine(NurbsBase curve, IList<double> knotsToInsert)
Parameters
Type Name Description
NurbsBase curve

The curve object.

System.Collections.Generic.IList<System.Double> knotsToInsert

The set of knots.

Returns
Type Description
NurbsBase

A curve with refined knots.

| Improve this Doc View Source

Refine(NurbsSurface, IList<Double>, SurfaceDirection)

Performs a knot refinement on a surface by inserting knots at various parameters and updating the control point locations.
Implementation of Algorithm A5.5 of The NURBS Book by Piegl and Tiller. ToDo: refactor this algo following the book.

Declaration
public static NurbsSurface Refine(NurbsSurface surface, IList<double> knotsToInsert, SurfaceDirection direction)
Parameters
Type Name Description
NurbsSurface surface

The surface object to insert the knots.

System.Collections.Generic.IList<System.Double> knotsToInsert

The set of knots to insert.

SurfaceDirection direction

Whether to insert in the U or V direction of the surface.

Returns
Type Description
NurbsSurface

A surface with the knots inserted.

| Improve this Doc View Source

Reverse(KnotVector)

Reverses the order of the knot vector.

Declaration
public static KnotVector Reverse(KnotVector knots)
Parameters
Type Name Description
KnotVector knots

Knot vectors to be reversed.

Returns
Type Description
KnotVector

Reversed knot vectors.

| Improve this Doc View Source

Span(Int32, Double)

Finds the span of the knot vector from curve degree and a parameter u on the curve.

Declaration
public int Span(int degree, double u)
Parameters
Type Name Description
System.Int32 degree

Curve degree.

System.Double u

Parameter on curve.

Returns
Type Description
System.Int32

The index of the knot span.

| Improve this Doc View Source

Span(Int32, Int32, Double)

Finds the span on the knot vector of the given parameter.
Corresponds to algorithm 2.1 from the NURBS book by Piegl and Tiller.

Declaration
public int Span(int n, int degree, double parameter)
Parameters
Type Name Description
System.Int32 n

Number of basis functions.

System.Int32 degree

Degree of function.

System.Double parameter

Parameter.

Returns
Type Description
System.Int32

The index of the knot span.

| Improve this Doc View Source

ToString()

Creates a text representation of the knot vector.

Declaration
public override string ToString()
Returns
Type Description
System.String

Knots in a string version.

Overrides
System.Object.ToString()
| Improve this Doc View Source

UniformPeriodic(Int32, Int32)

Generates a periodic uniform spaced knot vectors.

Declaration
public static KnotVector UniformPeriodic(int degree, int numberOfControlPts)
Parameters
Type Name Description
System.Int32 degree

Degree.

System.Int32 numberOfControlPts

Number of control points.

Returns
Type Description
KnotVector

Implements

System.Collections.Generic.IList<T>
System.Collections.Generic.ICollection<T>
System.Collections.Generic.IReadOnlyList<T>
System.Collections.Generic.IReadOnlyCollection<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IList
System.Collections.ICollection
System.Collections.IEnumerable

Extension Methods

ExtendedEnumerable.ToVector(IEnumerable<Double>)
ExtendedEnumerable.ToKnot(IEnumerable<Double>)
ExtendedEnumerable.Unique<T>(IEnumerable<T>, Func<T, T, Boolean>)