Class Spline
Represents a spline curve EntityObject (NURBS Non-Uniform Rational B-Splines).
Inherited Members
Namespace: netDxf.Entities
Assembly: CADability.dll
Syntax
public class Spline : EntityObject, IHasXData, ICloneable
Constructors
| Improve this Doc View SourceSpline(IEnumerable<Vector3>)
Initializes a new instance of the Spline class.
Declaration
public Spline(IEnumerable<Vector3> fitPoints)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IEnumerable<Vector3> | fitPoints | Spline fit points. |
Remarks
Spline entities created with a list of fit points cannot be used as a boundary path in a hatch.
Spline(List<SplineVertex>)
Initializes a new instance of the Spline class.
Declaration
public Spline(List<SplineVertex> controlPoints)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<SplineVertex> | controlPoints | Spline control points. |
Remarks
By default the degree of the spline is equal three.
Spline(List<SplineVertex>, Boolean)
Initializes a new instance of the Spline class.
Declaration
public Spline(List<SplineVertex> controlPoints, bool periodic)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<SplineVertex> | controlPoints | Spline control points. |
| System.Boolean | periodic | Sets if the spline as periodic closed (default false). |
Remarks
By default the degree of the spline is equal three.
Spline(List<SplineVertex>, List<Double>, Int16)
Initializes a new instance of the Spline class.
Declaration
public Spline(List<SplineVertex> controlPoints, List<double> knots, short degree)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<SplineVertex> | controlPoints | Spline control points. |
| System.Collections.Generic.List<System.Double> | knots | Spline knot vector. |
| System.Int16 | degree | Degree of the spline curve. Valid values are 1 (linear), degree 2 (quadratic), degree 3 (cubic), and so on up to degree 10. |
Spline(List<SplineVertex>, Int16)
Initializes a new instance of the Spline class.
Declaration
public Spline(List<SplineVertex> controlPoints, short degree)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<SplineVertex> | controlPoints | Spline control points. |
| System.Int16 | degree | Degree of the spline curve. Valid values are 1 (linear), degree 2 (quadratic), degree 3 (cubic), and so on up to degree 10. |
Spline(List<SplineVertex>, Int16, Boolean)
Initializes a new instance of the Spline class.
Declaration
public Spline(List<SplineVertex> controlPoints, short degree, bool periodic)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<SplineVertex> | controlPoints | Spline control points. |
| System.Int16 | degree | Degree of the spline curve. Valid values are 1 (linear), degree 2 (quadratic), degree 3 (cubic), and so on up to degree 10. |
| System.Boolean | periodic | Sets if the spline as periodic closed (default false). |
Properties
| Improve this Doc View SourceControlPoints
Gets the spline SplineVertex list.
Declaration
public IReadOnlyList<SplineVertex> ControlPoints { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyList<SplineVertex> |
CreationMethod
Gets the spline creation method.
Declaration
public SplineCreationMethod CreationMethod { get; }
Property Value
| Type | Description |
|---|---|
| SplineCreationMethod |
CtrlPointTolerance
Gets or sets the control point tolerance.
Declaration
public double CtrlPointTolerance { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
Degree
Gets or sets the polynomial degree of the resulting spline.
Declaration
public short Degree { get; }
Property Value
| Type | Description |
|---|---|
| System.Int16 |
Remarks
Valid values are 1 (linear), degree 2 (quadratic), degree 3 (cubic), and so on up to degree 10.
EndTangent
Gets or sets the spline curve end tangent.
Declaration
public Vector3? EndTangent { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<Vector3> |
Remarks
Only applicable to splines created with fit points.
FitPoints
Gets the spline Vector3 list.
Declaration
public List<Vector3> FitPoints { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<Vector3> |
FitTolerance
Gets or sets the fit point tolerance.
Declaration
public double FitTolerance { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
IsClosed
Gets if the spline is closed.
Declaration
public bool IsClosed { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsPeriodic
Gets if the spline is periodic.
Declaration
public bool IsPeriodic { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
KnotParameterization
Gets or set the knot parameterization computational method.
Declaration
public SplineKnotParameterization KnotParameterization { get; set; }
Property Value
| Type | Description |
|---|---|
| SplineKnotParameterization |
Remarks
Only applicable to splines created with fit points.
Knots
Gets the spline knot vector.
Declaration
public IReadOnlyList<double> Knots { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyList<System.Double> |
Remarks
By default a uniform knot vector is created.
KnotTolerance
Gets or sets the knot tolerance.
Declaration
public double KnotTolerance { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
StartTangent
Gets or sets the spline curve start tangent.
Declaration
public Vector3? StartTangent { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<Vector3> |
Remarks
Only applicable to splines created with fit points.
Methods
| Improve this Doc View SourceClone()
Creates a new Spline that is a copy of the current instance.
Declaration
public override object Clone()
Returns
| Type | Description |
|---|---|
| System.Object | A new Spline that is a copy of this instance. |
Overrides
| Improve this Doc View SourcePolygonalVertexes(Int32)
Converts the spline in a list of vertexes.
Declaration
public List<Vector3> PolygonalVertexes(int precision)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | precision | Number of vertexes generated. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<Vector3> | A list vertexes that represents the spline. |
Reverse()
Switch the polyline direction.
Declaration
public void Reverse()
SetUniformWeights(Double)
Sets all control point weights to the specified number.
Declaration
public void SetUniformWeights(double weight)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | weight | Control point weight. |
ToPolyline(Int32)
Converts the spline in a Polyline.
Declaration
public Polyline ToPolyline(int precision)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | precision | Number of vertexes generated. |
Returns
| Type | Description |
|---|---|
| Polyline | A new instance of Polyline that represents the spline. |
TransformBy(Matrix3, Vector3)
Moves, scales, and/or rotates the current entity given a 3x3 transformation matrix and a translation vector.
Declaration
public override void TransformBy(Matrix3 transformation, Vector3 translation)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix3 | transformation | Transformation matrix. |
| Vector3 | translation | Translation vector. |
Overrides
Remarks
Matrix3 adopts the convention of using column vectors to represent a transformation matrix.