Class NurbsSurface
This class represents a NURBS surface.
public class NurbsSurface : IGeometry<NurbsSurface>, IEquatable<NurbsSurface>, ITransformable<NurbsSurface>
Point3 p1 = new Point3(0.0, 0.0, 0.0);
Point3 p2 = new Point3(10.0, 0.0, 0.0);
Point3 p3 = new Point3(10.0, 10.0, 2.0);
Point3 p4 = new Point3(0.0, 10.0, 4.0);
NurbsSurface surface = NurbsSurface.FromCorners(p1, p2, p3, p4);
A 2D collection of points, V direction increases from left to right, the U direction from bottom to top.
public List<List<Point3>> ControlPointLocations { get; }
Type | Description |
---|---|
System.Collections.Generic.List<System.Collections.Generic.List<Point3>> |
A 2d collection of control points, V direction increases from left to right, the U direction from bottom to top.
public List<List<Point4>> ControlPoints { get; }
Type | Description |
---|---|
System.Collections.Generic.List<System.Collections.Generic.List<Point4>> |
The degree in U direction.
public int DegreeU { get; }
Type | Description |
---|---|
System.Int32 |
The degree in V direction.
public int DegreeV { get; }
Type | Description |
---|---|
System.Int32 |
The knotVector in U direction.
public KnotVector KnotsU { get; }
Type | Description |
---|---|
KnotVector |
The knotVector in V direction.
public KnotVector KnotsV { get; }
Type | Description |
---|---|
KnotVector |
A 2d collection of weight values.
public List<List<double>> Weights { get; }
Type | Description |
---|---|
System.Collections.Generic.List<System.Collections.Generic.List<System.Double>> |
Extracts the boundary curves of the surface.
public NurbsBase[] BoundaryEdges()
Type | Description |
---|---|
NurbsBase[] | The boundary edges. |
Computes the U and V parameters of the surface that is closest to the test point.
public (double U, double V) ClosestParameter(Point3 point)
Type | Name | Description |
---|---|---|
Point3 | point | The point to test against. |
Type | Description |
---|---|
System.ValueTuple<System.Double, System.Double> | The U and V parameters of the surface that are closest to the test point. |
Computes the point on the surface that is closest to the test point.
public Point3 ClosestPoint(Point3 point)
Type | Name | Description |
---|---|---|
Point3 | point | The point to test against. |
Type | Description |
---|---|
Point3 | The closest point on the surface. |
Compares if two NURBS surfaces are the same.
Two NURBS curves are equal when the have same degrees, same control points order and dimension, and same knots.
public bool Equals(NurbsSurface other)
Type | Name | Description |
---|---|---|
NurbsSurface | other | The NURBS surface. |
Type | Description |
---|---|
System.Boolean | Return true if the NURBS surface are equal. |
Evaluate the surface at the given U and V parameters.
public Vector3 EvaluateAt(double u, double v, EvaluateSurfaceDirection direction)
Type | Name | Description |
---|---|---|
System.Double | u | U parameter. |
System.Double | v | V parameter. |
EvaluateSurfaceDirection | direction | The evaluate direction required as result. |
Type | Description |
---|---|
Vector3 | The unitized tangent vector in the direction selected. |
Constructs a NURBS surface from four corners.
If the corners are ordered ccw the normal of the surface will point up otherwise, if corners ordered cw the normal will point down.
The surface is defined of degree 1.
public static NurbsSurface FromCorners(Point3 p1, Point3 p2, Point3 p3, Point3 p4)
Type | Name | Description |
---|---|---|
Point3 | p1 | The first point. |
Point3 | p2 | The second point. |
Point3 | p3 | The third point. |
Point3 | p4 | The fourth point. |
Type | Description |
---|---|
NurbsSurface |
Constructs a surface extruding a curve profile long a direction.
public static NurbsSurface FromExtrusion(Vector3 direction, NurbsBase profile)
Type | Name | Description |
---|---|---|
Vector3 | direction | The extrusion direction. |
NurbsBase | profile | The profile curve to extrude. |
Type | Description |
---|---|
NurbsSurface | The extruded surface. |
Constructs a NURBS surface from a set of NURBS curves.
public static NurbsSurface FromLoft(IList<NurbsBase> curves, LoftType loftType = LoftType.Normal)
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<NurbsBase> | curves | Set of a minimum of two curves to create the surface. |
LoftType | loftType | Enum to choose the type of loft generation. |
Type | Description |
---|---|
NurbsSurface | A NURBS surface. |
Constructs a NURBS surface from a 2D grid of points.
The grid of points should be organized as, the V direction from left to right and the U direction increases from bottom to top.
public static NurbsSurface FromPoints(int degreeU, int degreeV, List<List<Point3>> points, List<List<double>> weight = null)
Type | Name | Description |
---|---|---|
System.Int32 | degreeU | Degree of surface in U direction. |
System.Int32 | degreeV | Degree of surface in V direction. |
System.Collections.Generic.List<System.Collections.Generic.List<Point3>> | points | Points locations. |
System.Collections.Generic.List<System.Collections.Generic.List<System.Double>> | weight | A 2D collection of weights. |
Type | Description |
---|---|
NurbsSurface | A NURBS surface. |
Constructs a sweep surface with one rail curve. Follows the algorithm A10.2 at page 477 of The NURBS Book by Piegl and Tiller.
public static NurbsSurface FromSweep(NurbsBase rail, NurbsBase profile, Vector3? startTangent = null, Vector3? endTangent = null)
Type | Name | Description |
---|---|---|
NurbsBase | rail | The rail curve. |
NurbsBase | profile | The section curve. |
System.Nullable<Vector3> | startTangent | If not null override start tangent vector. |
System.Nullable<Vector3> | endTangent | If not null override end tangent vector. |
Type | Description |
---|---|
NurbsSurface | The sweep surface. |
Checks if the surface is closed.
A surface is closed if the first points and the lasts in a direction are coincident.
public bool IsClosed(SurfaceDirection direction)
Type | Name | Description |
---|---|---|
SurfaceDirection | direction |
Type | Description |
---|---|
System.Boolean | True if the curve is closed. |
Extracts the isoparametric curves (isocurves) at the given parameter and surface direction.
public NurbsCurve IsoCurve(double parameter, SurfaceDirection direction)
Type | Name | Description |
---|---|---|
System.Double | parameter | The parameter between 0.0 to 1.0 whether the isocurve will be extracted. |
SurfaceDirection | direction | The U or V direction whether the isocurve will be extracted. |
Type | Description |
---|---|
NurbsCurve | The isocurve extracted. |
Checks is surface is planar within specified tolerance.
public bool IsPlanar(double tolerance = 1E-10)
Type | Name | Description |
---|---|---|
System.Double | tolerance |
Type | Description |
---|---|
System.Boolean |
Evaluates a point at a given U and V parameters.
public Point3 PointAt(double u, double v)
Type | Name | Description |
---|---|---|
System.Double | u | Evaluation U parameter. |
System.Double | v | Evaluation V parameter. |
Type | Description |
---|---|
Point3 | A evaluated point. |
Reverses the parameterization of a surface in the specified direction. The domain is unaffected.
public NurbsSurface Reverse(SurfaceDirection surfaceDirection)
Type | Name | Description |
---|---|---|
SurfaceDirection | surfaceDirection | The U or V direction whether the surface will be reversed. |
Type | Description |
---|---|
NurbsSurface | A surface reversed in the specified direction. |
Creates a surface of revolution through an arbitrary angle, and axis. Corresponds the algorithm A8.1 of The NURBS Book by Piegl and Tiller.
public static NurbsSurface Revolved(NurbsBase curveProfile, Ray axis, double rotationAngle)
Type | Name | Description |
---|---|---|
NurbsBase | curveProfile | Profile curve. |
Ray | axis | Revolution axis. |
System.Double | rotationAngle | Angle in radiance. |
Type | Description |
---|---|
NurbsSurface | The revolution surface. |
Constructs a ruled surface between two curves. Follows the algorithm at page 337 of The NURBS Book by Piegl and Tiller.
public static NurbsSurface Ruled(NurbsBase curveA, NurbsBase curveB)
Type | Name | Description |
---|---|---|
NurbsBase | curveA | The first curve. |
NurbsBase | curveB | The second curve. |
Type | Description |
---|---|
NurbsSurface | A ruled surface. |
Splits (divides) the surface into two parts at the specified parameter
public NurbsSurface[] SplitAt(double parameter, SplitDirection direction)
Type | Name | Description |
---|---|---|
System.Double | parameter | The parameter at which to split the surface, parameter should be between 0 and 1. |
SplitDirection | direction | Where to split in the U or V direction of the surface. |
Type | Description |
---|---|
NurbsSurface[] | If the surface is split vertically (U direction) the left side is returned as the first surface and the right side is returned as the second surface. |
Implements the override method to string.
public override string ToString()
Type | Description |
---|---|
System.String | The representation of a NURBS surface in string. |
Transforms a NURBS surface with the given transformation matrix.
public NurbsSurface Transform(TransformMatrix transformation)
Type | Name | Description |
---|---|---|
TransformMatrix | transformation | The transformation matrix. |
Type | Description |
---|---|
NurbsSurface | A new NURBS surface transformed. |