Generated by DocFX

Class NurbsBase

This class represents a base class that is common to most curve types.

Inheritance
System.Object
NurbsBase
Circle
Line
NurbsCurve
PolyCurve
PolyLine
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Syntax
public abstract class NurbsBase : IGeometry<NurbsBase>, IEquatable<NurbsBase>, ITransformable<NurbsBase>

Constructors

| Improve this Doc View Source

NurbsBase()

Declaration
protected NurbsBase()
| Improve this Doc View Source

NurbsBase(Int32, KnotVector, List<Point4>)

Declaration
protected NurbsBase(int degree, KnotVector knots, List<Point4> controlPoints)
Parameters
Type Name Description
System.Int32 degree
KnotVector knots
System.Collections.Generic.List<Point4> controlPoints

Properties

| Improve this Doc View Source

ControlPointLocations

Gets the control points in their rational form.

Declaration
public List<Point3> ControlPointLocations { get; protected set; }
Property Value
Type Description
System.Collections.Generic.List<Point3>
| Improve this Doc View Source

ControlPoints

Gets the control points in their homogenized form.

Declaration
public List<Point4> ControlPoints { get; protected set; }
Property Value
Type Description
System.Collections.Generic.List<Point4>
| Improve this Doc View Source

Degree

Gets the degree of the curve.

Declaration
public int Degree { get; protected set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

EndPoint

Declaration
public virtual Point3 EndPoint { get; }
Property Value
Type Description
Point3
| Improve this Doc View Source

IsClosed

Checks if a curve is closed.
A curve is closed if the first point and the last are the same.

Declaration
public virtual bool IsClosed { get; }
Property Value
Type Description
System.Boolean

True if the curve is closed.

| Improve this Doc View Source

IsPeriodic

Checks if a curve is periodic.
A curve is periodic, where the number of overlapping points is equal the curve degree.

Declaration
public bool IsPeriodic { get; }
Property Value
Type Description
System.Boolean

True if the curve is periodic.

| Improve this Doc View Source

Knots

Gets the knots vectors of the curve.

Declaration
public KnotVector Knots { get; protected set; }
Property Value
Type Description
KnotVector
| Improve this Doc View Source

Length

Declaration
public virtual double Length { get; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

MidPoint

Declaration
public virtual Point3 MidPoint { get; }
Property Value
Type Description
Point3
| Improve this Doc View Source

StartPoint

Declaration
public virtual Point3 StartPoint { get; }
Property Value
Type Description
Point3
| Improve this Doc View Source

Weights

Gets the list of weight values.

Declaration
public List<double> Weights { get; protected set; }
Property Value
Type Description
System.Collections.Generic.List<System.Double>

Methods

| Improve this Doc View Source

ClampEnds()

Converts a curve where the knotVector is clamped.

Declaration
public NurbsBase ClampEnds()
Returns
Type Description
NurbsBase

A curve with clamped knots.

| Improve this Doc View Source

Close()

Creates a periodic curve.
This method uses the control point wrapping solution. https://pages.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/bspline-curve-closed.html

Declaration
public virtual NurbsBase Close()
Returns
Type Description
NurbsBase

A periodic curve.

| Improve this Doc View Source

ClosestParameter(Point3)

Declaration
public virtual double ClosestParameter(Point3 pt)
Parameters
Type Name Description
Point3 pt
Returns
Type Description
System.Double
| Improve this Doc View Source

ClosestPoint(Point3)

Declaration
public virtual Point3 ClosestPoint(Point3 point)
Parameters
Type Name Description
Point3 point
Returns
Type Description
Point3
| Improve this Doc View Source

CurvatureAt(Double)

Computes the curvature vector of the curve at the parameter. The vector has length equal to the radius of the curvature circle and with direction to the center of the circle.

Declaration
public Vector3 CurvatureAt(double t)
Parameters
Type Name Description
System.Double t

Evaluation parameter. Parameter should be between 0.0 and 1.0.

Returns
Type Description
Vector3

The curvature vector.

| Improve this Doc View Source

DecomposeIntoBeziers()

Decompose a curve into a collection of Beziers curves.

Declaration
public List<NurbsBase> DecomposeIntoBeziers()
Returns
Type Description
System.Collections.Generic.List<NurbsBase>

A collection of Beziers.

| Improve this Doc View Source

DerivativeAt(Double, Int32)

Determines the derivatives of a curve at a given parameter.

Declaration
public List<Vector3> DerivativeAt(double t, int numberOfDerivatives = 1)
Parameters
Type Name Description
System.Double t

Parameter on the curve at which the point is to be evaluated. Parameter should be between 0.0 and 1.0.

System.Int32 numberOfDerivatives

The number of derivatives required.

Returns
Type Description
System.Collections.Generic.List<Vector3>

The derivatives.

| Improve this Doc View Source

Divide(Double, Boolean)

Divides a curve for a given max segment length, including the end points.
The result is not split curves but a collection of t values and lengths that can be used for splitting.
As with all arc length methods, the result is an approximation.

Declaration
public (List<Point3> Points, List<double> Parameters) Divide(double maxSegmentLength, bool equalSegmentLengths = false)
Parameters
Type Name Description
System.Double maxSegmentLength

The maximum length the segments have to be split in.

System.Boolean equalSegmentLengths

Force to have all the segments of the same lengths.

Returns
Type Description
System.ValueTuple<System.Collections.Generic.List<Point3>, System.Collections.Generic.List<System.Double>>

A tuple define the t values where the curve is divided and the lengths between each division.

| Improve this Doc View Source

Divide(Int32)

Divides a curve for a given number of time, including the end points.
The result is not split curves but a collection of t values and lengths that can be used for splitting.
As with all arc length methods, the result is an approximation.

Declaration
public (List<Point3> Points, List<double> Parameters) Divide(int numberOfSegments)
Parameters
Type Name Description
System.Int32 numberOfSegments

The number of parts to split the curve into.

Returns
Type Description
System.ValueTuple<System.Collections.Generic.List<Point3>, System.Collections.Generic.List<System.Double>>

A tuple define the t values where the curve is divided and the lengths between each division.

| Improve this Doc View Source

DivideByChordLength(Double)

Divides a curve by a given chord length. Last chord will be of whatever length is left at the end of the curve.

Declaration
public List<double> DivideByChordLength(double chordLength)
Parameters
Type Name Description
System.Double chordLength

Desired chord length.

Returns
Type Description
System.Collections.Generic.List<System.Double>

Collection of curve parameters along the curve.

| Improve this Doc View Source

ElevateDegree(Int32)

Elevates the degree of a curve. Implementation of Algorithm A5.9 of The NURBS Book by Piegl and Tiller.

Declaration
public NurbsBase ElevateDegree(int desiredDegree)
Parameters
Type Name Description
System.Int32 desiredDegree

The expected final degree. If the supplied degree is less or equal the curve is returned unmodified.

Returns
Type Description
NurbsBase

The curve after degree elevation.

| Improve this Doc View Source

Equals(NurbsBase)

Compares two curves for equality.
Two curves are equal when the have same control points, weights, knots and degree.

Declaration
public bool Equals(NurbsBase other)
Parameters
Type Name Description
NurbsBase other

The other curve.

Returns
Type Description
System.Boolean

Return true if the curves are equal.

| Improve this Doc View Source

Equals(Object)

Compares if two curves are the same.
Two curves are equal when the have same degree, same control points order and dimension, and same knots.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The curve object.

Returns
Type Description
System.Boolean

Return true if the curves are equal.

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

Extrema()

Computes the parameter values of all local extrema.

Declaration
public IReadOnlyList<double> Extrema()
Returns
Type Description
System.Collections.Generic.IReadOnlyList<System.Double>

The parameter values of all the local extrema.

| Improve this Doc View Source

GetBoundingBox()

Gets the bounding box of the curve.

Declaration
public virtual BoundingBox GetBoundingBox()
Returns
Type Description
BoundingBox
| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()
| Improve this Doc View Source

Join(IList<NurbsBase>)

Joins all the curves, if it is possible.

Declaration
public static PolyCurve Join(IList<NurbsBase> curves)
Parameters
Type Name Description
System.Collections.Generic.IList<NurbsBase> curves

The curves to join.

Returns
Type Description
PolyCurve

The polycurve that is the result of joining all the curves.

| Improve this Doc View Source

LengthAt(Double)

Declaration
public virtual double LengthAt(double t)
Parameters
Type Name Description
System.Double t
Returns
Type Description
System.Double
| Improve this Doc View Source

Offset(Double, Plane)

Computes the offset of the curve.

Declaration
public virtual NurbsBase Offset(double distance, Plane pln)
Parameters
Type Name Description
System.Double distance

The distance of the offset. If negative the offset will be in the opposite side.

Plane pln

The plane for the offset operation.

Returns
Type Description
NurbsBase

The offset curve.

| Improve this Doc View Source

ParameterAtChordLength(Double, Double)

Evaluates a point at a given chord length from a parameter on the curve.

Declaration
public double ParameterAtChordLength(double t, double chordLength)
Parameters
Type Name Description
System.Double t
System.Double chordLength
Returns
Type Description
System.Double
| Improve this Doc View Source

ParameterAtLength(Double)

Computes the parameter along the curve which coincides with a given length.

Declaration
public virtual double ParameterAtLength(double segmentLength)
Parameters
Type Name Description
System.Double segmentLength

Length of segment to measure. Must be less than or equal to the length of the curve.

Returns
Type Description
System.Double

The parameter on the curve at the given length.

| Improve this Doc View Source

PerpendicularFrameAt(Double)

Calculates the 3D plane at the given parameter. Defined as the Frenet frame, is constructed from the velocity and the acceleration of the curve. https://janakiev.com/blog/framing-parametric-curves/

Declaration
public Plane PerpendicularFrameAt(double t)
Parameters
Type Name Description
System.Double t

Evaluation parameter. Parameter should be between 0.0 and 1.0.

Returns
Type Description
Plane

The perpendicular frame.

| Improve this Doc View Source

PerpendicularFrames(List<Double>, Nullable<Vector3>, Nullable<Vector3>)

Creates rotation minimized perpendicular frames (RMF) at given t parameters along the curve.
Double reflection method taken from Wang, W., J¨uttler, B., Zheng, D., and Liu, Y. 2008. "Computation of rotation minimizing frame."
https://www.microsoft.com/en-us/research/wp-content/uploads/2016/12/Computation-of-rotation-minimizing-frames.pdf

Declaration
public List<Plane> PerpendicularFrames(List<double> uValues, Vector3? startTangent = null, Vector3? endTangent = null)
Parameters
Type Name Description
System.Collections.Generic.List<System.Double> uValues

The curve parameter values to locate perpendicular curve frames

System.Nullable<Vector3> startTangent

If not null override start tangent vector.

System.Nullable<Vector3> endTangent

If not null override end tangent vector.

Returns
Type Description
System.Collections.Generic.List<Plane>

A collection of planes.

| Improve this Doc View Source

PointAt(Double)

Declaration
public virtual Point3 PointAt(double t)
Parameters
Type Name Description
System.Double t
Returns
Type Description
Point3
| Improve this Doc View Source

PointAtLength(Double)

Declaration
public virtual Point3 PointAtLength(double length)
Parameters
Type Name Description
System.Double length
Returns
Type Description
Point3
| Improve this Doc View Source

PointAtNormalizedLength(Double)

Evaluates a point at the normalized length.

Declaration
public virtual Point3 PointAtNormalizedLength(double normalizedLength)
Parameters
Type Name Description
System.Double normalizedLength

The length factor is normalized between 0.0 and 1.0.

Returns
Type Description
Point3

The point at the length.

| Improve this Doc View Source

ReduceDegree(Double)

Reduce the degree of a NURBS curve. Implementation of Algorithm A5.11 of The NURBS Book by Piegl and Tiller. ToDo: Remove the tolerance, just let reduce and output the max deviation. ToDo: Try this method to reduce the bezier, looks more accurate. https://pomax.github.io/bezierinfo/chapters/reordering/reorder.js

Declaration
public NurbsBase ReduceDegree(double tolerance = 0.001)
Parameters
Type Name Description
System.Double tolerance

Tolerance value declaring if the curve is degree reducible. Default value set to 10e-4, refer to Eq 5.30 for the meaning.

Returns
Type Description
NurbsBase

The curve after degree reduction, the curve will be degree - 1 from the input.

| Improve this Doc View Source

Reverse()

Reverses the parametrization of the curve.

Declaration
public virtual NurbsBase Reverse()
Returns
Type Description
NurbsBase

A reversed curve.

| Improve this Doc View Source

SplitAt(Double)

Splits a curve into two parts at a given parameter.

Declaration
public List<NurbsBase> SplitAt(double t)
Parameters
Type Name Description
System.Double t

The parameter at which to split the curve.

Returns
Type Description
System.Collections.Generic.List<NurbsBase>

Two curves.

| Improve this Doc View Source

SplitAt(Double[])

Splits a curve at given parameters and returns the segments as curves.

Declaration
public List<NurbsBase> SplitAt(double[] parameters)
Parameters
Type Name Description
System.Double[] parameters

The parameters at which to split the curve. Values should be between 0.0 and 1.0.

Returns
Type Description
System.Collections.Generic.List<NurbsBase>

Collection of curve segments.

| Improve this Doc View Source

SubCurve(Interval)

Extract sub-curve defined by domain.

Declaration
public NurbsBase SubCurve(Interval domain)
Parameters
Type Name Description
Interval domain

Domain of sub-curve

Returns
Type Description
NurbsBase

The sub curve.

| Improve this Doc View Source

TangentAt(Double)

Computes the curve tangent at the given parameter.

Declaration
public virtual Vector3 TangentAt(double t)
Parameters
Type Name Description
System.Double t

The parameter to sample the curve. Parameter should be between 0.0 and 1.0.

Returns
Type Description
Vector3

The unitized tangent vector at the given parameter.

| Improve this Doc View Source

ToString()

Implements the override method to string.

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

The representation of a curve in string.

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

Transform(TransformMatrix)

Applies a transformation on the geometry object and returns the transformed geometry.

Declaration
public NurbsBase Transform(TransformMatrix t)
Parameters
Type Name Description
TransformMatrix t

The transformation matrix that represents the transformation.

Returns
Type Description
NurbsBase

The transformed geometry

Implements

IGeometry<T>
System.IEquatable<T>
ITransformable<T>