SFCGAL  2.3.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
SFCGAL::NURBSCurve Class Reference

Non-Uniform Rational B-Spline (NURBS) curve implementation. More...

#include <NURBSCurve.h>

Inherits SFCGAL::GeometryImpl< Derived, Base >.

Public Types

enum  KnotMethod : std::uint8_t { KnotMethod::UNIFORM, KnotMethod::CHORD_LENGTH, KnotMethod::CENTRIPETAL }
 Knot vector generation methods for parameterization. More...
 
enum  EndCondition : std::uint8_t { EndCondition::CLAMPED, EndCondition::NATURAL, EndCondition::PERIODIC, EndCondition::TANGENT }
 End conditions for curve fitting and interpolation. More...
 
enum  FitMethod : std::uint8_t { FitMethod::INTERPOLATE, FitMethod::APPROXIMATE }
 Curve fitting methods. More...
 
using FT = Kernel::FT
 Floating-point type for NURBS calculations. More...
 
using ControlPoint = Point
 Type for NURBS control points. More...
 
using Weight = FT
 Type for NURBS weights (positive values) More...
 
using Knot = FT
 Type for knot values in knot vector. More...
 
using Parameter = FT
 Type for curve parameter values. More...
 

Public Member Functions

 NURBSCurve ()
 Default constructor creating empty curve. More...
 
 NURBSCurve (const std::vector< Point > &controlPoints, unsigned int degree, KnotMethod knotMethod=KnotMethod::UNIFORM)
 Constructor with control points and uniform weights. More...
 
 NURBSCurve (const std::vector< Point > &controlPoints, const std::vector< FT > &weights, unsigned int degree, KnotMethod knotMethod=KnotMethod::UNIFORM)
 Constructor with control points and explicit weights. More...
 
 NURBSCurve (const std::vector< Point > &controlPoints, const std::vector< FT > &weights, unsigned int degree, const std::vector< Knot > &knotVector)
 Full constructor with all NURBS parameters. More...
 
 NURBSCurve (const NURBSCurve &other)=default
 Copy constructor. More...
 
auto operator= (const NURBSCurve &other) -> NURBSCurve &=default
 Assignment operator. More...
 
 ~NURBSCurve () override=default
 Destructor. More...
 
void accept (GeometryVisitor &visitor) override
 Accept visitor pattern for non-const operations. More...
 
void accept (ConstGeometryVisitor &visitor) const override
 Accept visitor pattern for const operations. More...
 
auto geometryTypeId () const -> GeometryType override
 Get the geometry type identifier. More...
 
auto geometryType () const -> std::string override
 Get the geometry type as string. More...
 
auto isEmpty () const -> bool override
 Check if curve is empty. More...
 
auto is3D () const -> bool override
 Check if curve is three-dimensional. More...
 
auto isMeasured () const -> bool override
 Check if curve has measure coordinates. More...
 
auto dropZ () -> bool override
 Drop Z coordinates from curve. More...
 
auto dropM () -> bool override
 Drop M coordinates from curve. More...
 
void swapXY () override
 Swap the X and Y coordinates of all control points and any stored fit data. More...
 
auto evaluate (Parameter parameter) const -> Point override
 Evaluate the curve at the given parameter and return the corresponding point in Cartesian space. More...
 
auto derivative (Parameter parameter, unsigned int order=1) const -> Point override
 Compute the derivative of the curve at the given parameter. More...
 
auto tangent (Parameter parameter) const -> Point override
 Return the unit tangent vector at the given parameter. More...
 
auto normal (Parameter parameter) const -> Point override
 Return the principal unit normal vector at the given parameter. More...
 
auto binormal (Parameter parameter) const -> Point override
 Return the unit binormal vector at the given parameter. More...
 
auto curvature (Parameter parameter) const -> FT override
 Compute the curvature scalar at the given parameter. More...
 
auto torsion (Parameter parameter) const -> FT override
 Compute the torsion scalar at the given parameter. More...
 
auto frenetFrame (Parameter parameter) const -> std::tuple< Point, Point, Point > override
 Return the Frenet frame at the given parameter as (tangent, normal, binormal). More...
 
auto toLineString (unsigned int numSegments=32) const -> std::unique_ptr< LineString > override
 Convert the curve to a LineString by sampling numSegments uniformly in parameter space. More...
 
auto toLineStringAdaptive (FT tolerance=FT(1e-3), unsigned int minSegments=8, unsigned int maxSegments=256) const -> std::unique_ptr< LineString > override
 Convert the curve to a LineString using adaptive subdivision until the polyline approximates the curve within tolerance, respecting minSegments and maxSegments bounds. More...
 
auto parameterBounds () const -> std::pair< Parameter, Parameter > override
 Return the parameter domain of the curve as [u_min, u_max]. More...
 
auto isPeriodic () const -> bool override
 True if the curve is periodic (periodic knot structure and matching end conditions). More...
 
auto isPlanar (std::vector< FT > *plane=nullptr) const -> bool override
 Check whether the curve is planar. More...
 
auto isLinear () const -> bool override
 Determine whether the curve is geometrically linear (represents a straight line). More...
 
auto degree () const -> unsigned int override
 Return the polynomial degree of the curve. More...
 
auto length (Parameter from=Parameter(-1), Parameter to=Parameter(-1), FT tolerance=FT(1e-6)) const -> FT override
 Compute arc length between two parameters. More...
 
auto parameterAtLength (FT arcLength, FT tolerance=FT(1e-6)) const -> Parameter override
 Find the parameter corresponding to a given arc length measured from the start of the curve. More...
 
auto reparameterizeByArcLength () const -> std::unique_ptr< Curve > override
 Return a new Curve reparameterized by arc length (parameter runs proportionally to arc length). More...
 
auto split (Parameter parameter) const -> std::pair< std::unique_ptr< Curve >, std::unique_ptr< Curve >> override
 Split the curve at parameter into two curves [domain_start, parameter] and [parameter, domain_end]. More...
 
auto subcurve (Parameter from, Parameter to) const -> std::unique_ptr< Curve > override
 Extract a subcurve between parameters from and to (inclusive of domain interval). More...
 
auto reverse () const -> std::unique_ptr< Curve > override
 Return a new Curve representing this curve with reversed parameter direction. More...
 
auto join (const Curve &other, Continuity continuity=Continuity::C0, FT tolerance=FT(1e-6)) const -> std::unique_ptr< Curve > override
 Join this curve with other producing a single curve if they can be connected within the requested continuity and tolerance. More...
 
auto closestPoint (const Point &point, Parameter *outParameter=nullptr) const -> Point override
 Project point onto the curve and return the closest point on the curve. More...
 
auto controlPoints () const -> const std::vector< Point > &
 Get control points array. More...
 
void setControlPoints (const std::vector< Point > &controlPoints)
 Set all control points with validation. More...
 
auto controlPointN (size_t index) -> Point &override
 Access control point for modification. More...
 
auto controlPointN (size_t index) const -> const Point &override
 Access control point for reading. More...
 
void setControlPoint (size_t index, const Point &point)
 Set individual control point with validation. More...
 
auto weights () const -> const std::vector< FT > &
 Get weights array. More...
 
void setWeights (const std::vector< FT > &weights)
 Set all weights with validation. More...
 
auto weight (size_t index) const -> FT override
 Get weight at specified index. More...
 
void setWeight (size_t index, const FT &weight)
 Set weight at specified index. More...
 
auto isRational () const -> bool override
 Check if curve uses non-uniform rational weights. More...
 
auto isBezier () const -> bool
 Return true when this NURBS curve is represented in Bezier form. More...
 
auto isBSpline () const -> bool
 Return true when the curve is a non-rational B-spline (uniform weights). More...
 
auto knotVector () const -> const std::vector< Knot > &
 Return the knot vector for this curve. More...
 
void setKnotVector (const std::vector< Knot > &knots)
 Set knot vector with full validation. More...
 
auto knot (size_t index) const -> Knot
 Get knot value at index. More...
 
auto knotMultiplicity (const Knot &value, const FT &tolerance=FT(1e-10)) const -> unsigned int
 Count multiplicity of knot value. More...
 
auto order () const -> unsigned int
 Get curve order (degree + 1) More...
 
auto numControlPoints () const -> size_t override
 Get number of control points. More...
 
auto numKnots () const -> size_t
 Get number of knots in vector. More...
 
auto insertKnot (const Knot &parameter, unsigned int times=1) const -> std::unique_ptr< NURBSCurve >
 Insert knot into curve without changing shape (Oslo algorithm) More...
 
auto refineKnotVector (const std::vector< Knot > &newKnots) const -> std::unique_ptr< NURBSCurve >
 Refine knot vector by adding multiple knots. More...
 
auto elevateDegree (unsigned int times=1) const -> std::unique_ptr< NURBSCurve >
 Elevate degree of curve (increases smoothness) More...
 
auto reduceDegree (const FT &tolerance=FT(1e-6)) const -> std::unique_ptr< NURBSCurve >
 Reduce degree if possible without shape change. More...
 
auto removeKnots (const FT &tolerance=FT(1e-6)) const -> std::unique_ptr< NURBSCurve >
 Remove unnecessary knots while preserving shape. More...
 
auto fitPoints () const -> const std::vector< Point > &
 Get original fit points if curve was created by fitting. More...
 
auto fitTolerance () const -> FT
 Get fitting tolerance used. More...
 
auto startTangent () const -> const std::optional< Point > &
 Get start tangent constraint if specified. More...
 
auto endTangent () const -> const std::optional< Point > &
 Get end tangent constraint if specified. More...
 
auto validateData () const -> std::pair< bool, std::string >
 Comprehensive NURBS data validation. More...
 
auto getCurveStatistics () const -> std::map< std::string, double >
 Get detailed curve statistics for debugging. More...
 

Static Public Member Functions

static auto fromBezier (const std::vector< Point > &controlPoints) -> std::unique_ptr< NURBSCurve >
 Create from Bezier control points. More...
 
static auto fromBSpline (const std::vector< Point > &controlPoints, unsigned int degree, const std::vector< Knot > &knots) -> std::unique_ptr< NURBSCurve >
 Create NURBS curve from explicit B-spline parameters. More...
 
static auto createBSpline (const std::vector< Point > &controlPoints, unsigned int degree) -> std::unique_ptr< NURBSCurve >
 Create uniform B-spline with automatic knot generation. More...
 
static auto createCircularArc (const Point &center, const FT &radius, const FT &startAngle, const FT &endAngle, const Point &normal=Point(0, 0, 1), KnotMethod knotMethod=KnotMethod::UNIFORM) -> std::unique_ptr< NURBSCurve >
 Create exact circular arc representation. More...
 
static auto interpolateCurve (const std::vector< Point > &points, unsigned int degree=3, KnotMethod knotMethod=KnotMethod::UNIFORM, EndCondition endCondition=EndCondition::CLAMPED) -> std::unique_ptr< NURBSCurve >
 Interpolate points exactly with specified continuity. More...
 
static auto approximateCurve (const std::vector< Point > &points, unsigned int degree, FT tolerance, size_t maxControlPoints=50) -> std::unique_ptr< NURBSCurve >
 Approximate points within tolerance using least squares. More...
 
static auto fitCurve (const std::vector< Point > &points, unsigned int degree=3, FitMethod fitMethod=FitMethod::INTERPOLATE, KnotMethod knotMethod=KnotMethod::UNIFORM, EndCondition endCondition=EndCondition::CLAMPED, FT tolerance=FT(1e-6), size_t maxControlPoints=50) -> std::unique_ptr< NURBSCurve >
 Unified curve fitting interface using FitMethod enum. More...
 

Protected Member Functions

auto findSpan (const Parameter &parameter) const -> size_t
 Find knot span containing parameter (Algorithm A2.1) More...
 
auto basisFunctionDerivatives (size_t span, const Parameter &parameter, unsigned int maxDerivative) const -> std::vector< std::vector< FT >>
 Compute basis functions and derivatives (Algorithm A2.3) More...
 
auto deBoorRational (size_t span, const Parameter &parameter) const -> Point
 Evaluate curve using De Boor's algorithm for rational curves. More...
 
auto computeDerivatives (const Parameter &parameter, unsigned int maxOrder) const -> std::vector< Point >
 Compute curve derivatives up to specified order (Algorithm A4.2) More...
 
auto checkDimensionalConsistency () const -> bool
 Check dimensional consistency across all control points. More...
 
auto computeArcLength (const Parameter &startParam, const Parameter &endParam, const FT &tolerance) const -> FT
 Compute arc length using adaptive Simpson quadrature. More...
 
auto speedFunction (Parameter t) const -> FT
 Compute speed function ||C'(t)|| for arc length integration. More...
 
auto simpsonRule (const Parameter &a, const Parameter &b) const -> FT
 Apply Simpson's rule over interval [a,b]. More...
 
auto adaptiveSimpsonArcLength (const Parameter &a, const Parameter &b, const FT &tolerance, unsigned int maxDepth=20) const -> FT
 Adaptive Simpson quadrature for arc length computation. More...
 
auto findParameterByArcLength (const FT &targetLength, const FT &tolerance) const -> Parameter
 Find parameter corresponding to arc length using Newton-Raphson. More...
 
auto projectPointToCurve (const Point &point, const FT &tolerance=FT(1e-9), unsigned int maxIterations=50) const -> std::pair< Point, Parameter >
 Project point onto curve using Newton's method. More...
 

Static Protected Member Functions

static auto generateKnotVector (const std::vector< Point > &points, unsigned int degree, KnotMethod method) -> std::vector< Knot >
 Generate knot vector using specified method. More...
 
static auto computeParameters (const std::vector< Point > &points, KnotMethod method) -> std::vector< Parameter >
 Compute parameter values for point sequence. More...
 
static auto validateNURBSData (const std::vector< Point > &controlPoints, const std::vector< FT > &weights, unsigned int degree, const std::vector< Knot > &knots) -> std::pair< bool, std::string >
 Validate complete NURBS data structure. More...
 
static auto generateKnotVectorForEndCondition (const std::vector< Parameter > &parameters, unsigned int degree, EndCondition endCondition) -> std::vector< Knot >
 Generate knot vector for specific end conditions. More...
 
static auto generateApproximationKnotVector (const std::vector< Parameter > &parameters, unsigned int degree, size_t numControlPoints) -> std::vector< Knot >
 Generate knot vector for least-squares approximation. More...
 
static auto interpolateClampedCurve (const std::vector< Point > &points, const std::vector< Parameter > &parameters, unsigned int degree, const std::vector< Knot > &knots) -> std::vector< Point >
 Interpolate points with clamped end conditions. More...
 
static auto interpolateNaturalCurve (const std::vector< Point > &points, const std::vector< Parameter > &parameters, unsigned int degree, const std::vector< Knot > &knots) -> std::vector< Point >
 Interpolate with natural end conditions (minimal curvature) More...
 
static auto interpolatePeriodicCurve (const std::vector< Point > &points, unsigned int degree, KnotMethod knotMethod) -> std::unique_ptr< NURBSCurve >
 Create periodic interpolating curve. More...
 

Protected Attributes

std::vector< Point > _controlPoints
 Control points in curve space. More...
 
std::vector< FT > _weights
 Weights (empty = all 1.0) More...
 
unsigned int _degree {0}
 Polynomial degree of the NURBS curve (non-negative). More...
 
std::vector< Knot > _knotVector
 Non-decreasing knot sequence. More...
 
std::vector< Point > _fitPoints
 Original points if fitted. More...
 
FT _fitTolerance {FT(0)}
 Fitting tolerance used. More...
 
std::optional< Point > _startTangent
 Start tangent constraint. More...
 
std::optional< Point > _endTangent
 End tangent constraint. More...
 

Detailed Description

Non-Uniform Rational B-Spline (NURBS) curve implementation.

Complete OGC/SQL-MM compliant implementation supporting XY, Z, M, ZM dimensions. Weights affect XYZ coordinates in homogeneous space (x*w, y*w, z*w, w). M coordinate is interpolated non-rationally through basis functions.

Based on "The NURBS Book" by Piegl & Tiller algorithms and NURBS-Python/geomdl. Uses Kernel::FT (Exact Predicates Exact Constructions) for numerical robustness.

Key Features

## Usage Examples

// Simple interpolation (exact fit through points)
auto curve1 = NURBSCurve::interpolateCurve(points, 3);
// Natural end conditions for smoother curves
auto curve2 = NURBSCurve::interpolateCurve(points, 3,
// Unified interface with explicit control
auto curve3 = NURBSCurve::fitCurve(points, 3,
// Create a Bézier curve from control points
std::vector<Point> bezierPoints = {
Point(0, 0), Point(1, 3), Point(3, 3), Point(4, 0) // Cubic Bézier
};
auto bezier = NURBSCurve::fromBezier(bezierPoints);
// Create a B-spline curve with automatic knot generation
std::vector<Point> controlPoints = {
Point(0, 0), Point(1, 2), Point(3, 3), Point(4, 1), Point(5, 0)
};
auto bspline = NURBSCurve::createBSpline(controlPoints, 3);
// Create a B-spline with explicit knot vector
std::vector<Point> explicitPoints = {Point(0, 0), Point(2, 1), Point(4, 0)};
std::vector<NURBSCurve::Knot> knots = {0, 0, 0, 1, 1, 1}; // Clamped
quadratic auto explicitBSpline = NURBSCurve::fromBSpline(explicitPoints, 2,
knots);
Since
2.3.0

Member Typedef Documentation

Type for NURBS control points.

using SFCGAL::NURBSCurve::FT = Kernel::FT

Floating-point type for NURBS calculations.

Type for knot values in knot vector.

Type for curve parameter values.

Type for NURBS weights (positive values)

Member Enumeration Documentation

enum SFCGAL::NURBSCurve::EndCondition : std::uint8_t
strong

End conditions for curve fitting and interpolation.

Controls the behavior at curve endpoints to achieve different mathematical and aesthetic properties.

Enumerator
CLAMPED 

Multiplicity degree+1 at curve ends (standard CAD behavior)

NATURAL 

Minimal curvature conditions (smoother, more organic curves)

PERIODIC 

Closed periodic curve with C^(degree-1) continuity at junction.

TANGENT 

User-specified tangent constraints at ends (future enhancement)

enum SFCGAL::NURBSCurve::FitMethod : std::uint8_t
strong

Curve fitting methods.

Determines the mathematical approach to curve generation from input points.

Enumerator
INTERPOLATE 

Pass exactly through all points (higher fidelity, may be less smooth)

APPROXIMATE 

Least squares approximation within tolerance (smoother, fewer control points)

enum SFCGAL::NURBSCurve::KnotMethod : std::uint8_t
strong

Knot vector generation methods for parameterization.

Enumerator
UNIFORM 

Equal knot spacing (fastest generation)

CHORD_LENGTH 

Based on Euclidean distances between points.

CENTRIPETAL 

Square root of chord length (often best shape preservation)

Constructor & Destructor Documentation

SFCGAL::NURBSCurve::NURBSCurve ( )

Default constructor creating empty curve.

SFCGAL::NURBSCurve::NURBSCurve ( const std::vector< Point > &  controlPoints,
unsigned int  degree,
KnotMethod  knotMethod = KnotMethod::UNIFORM 
)

Constructor with control points and uniform weights.

Parameters
controlPointsControl points defining curve shape
degreePolynomial degree of curve (must be < controlPoints.size())
knotMethodMethod for generating knot vector
SFCGAL::NURBSCurve::NURBSCurve ( const std::vector< Point > &  controlPoints,
const std::vector< FT > &  weights,
unsigned int  degree,
KnotMethod  knotMethod = KnotMethod::UNIFORM 
)

Constructor with control points and explicit weights.

Parameters
controlPointsControl points defining curve shape
weightsWeight for each control point (must match size)
degreePolynomial degree of curve
knotMethodMethod for generating knot vector
SFCGAL::NURBSCurve::NURBSCurve ( const std::vector< Point > &  controlPoints,
const std::vector< FT > &  weights,
unsigned int  degree,
const std::vector< Knot > &  knotVector 
)

Full constructor with all NURBS parameters.

Parameters
controlPointsControl points defining curve shape
weightsWeights (empty for uniform weights = 1.0)
degreePolynomial degree
knotVectorCustom knot vector (must satisfy m = n + p + 1)
SFCGAL::NURBSCurve::NURBSCurve ( const NURBSCurve &  other)
default

Copy constructor.

Parameters
otherThe NURBSCurve to copy
SFCGAL::NURBSCurve::~NURBSCurve ( )
overridedefault

Destructor.

Member Function Documentation

void SFCGAL::NURBSCurve::accept ( GeometryVisitor &  visitor)
override

Accept visitor pattern for non-const operations.

Parameters
visitorGeometry visitor to accept
void SFCGAL::NURBSCurve::accept ( ConstGeometryVisitor &  visitor) const
override

Accept visitor pattern for const operations.

Parameters
visitorConst geometry visitor to accept
auto SFCGAL::NURBSCurve::adaptiveSimpsonArcLength ( const Parameter &  a,
const Parameter &  b,
const FT &  tolerance,
unsigned int  maxDepth = 20 
) const -> FT
protected

Adaptive Simpson quadrature for arc length computation.

Parameters
aStart parameter
bEnd parameter
toleranceIntegration tolerance
maxDepthMaximum recursion depth (default 20)
Returns
Accurate arc length using adaptive subdivision
auto SFCGAL::NURBSCurve::approximateCurve ( const std::vector< Point > &  points,
unsigned int  degree,
FT  tolerance,
size_t  maxControlPoints = 50 
) -> std::unique_ptr<NURBSCurve>
static

Approximate points within tolerance using least squares.

Parameters
pointsPoints to approximate
degreeTarget curve degree
toleranceMaximum allowed deviation
maxControlPointsMaximum control points to use
Returns
Approximating NURBS curve within tolerance

NURBS Curve Approximation - Piegl & Tiller Algorithm A9.1

This implements true least-squares approximation, generating control points that minimize the sum of squared distances to input data points.

Mathematical Foundation:

  • Given: n+1 data points Q_k, k = 0,...,n
  • Find: m+1 control points P_j that minimize ||C(u_k) - Q_k||²
  • Where: C(u) = Σ_{j=0}^m N_{j,p}(u) * P_j (NURBS curve)

The least-squares problem becomes: N^T * N * P = N^T * Q where N_{i,j} = N_{j,p}(u_i) are the basis function values

auto SFCGAL::NURBSCurve::basisFunctionDerivatives ( size_t  span,
const Parameter &  parameter,
unsigned int  maxDerivative 
) const -> std::vector<std::vector<FT>>
protected

Compute basis functions and derivatives (Algorithm A2.3)

Parameters
spanKnot span index
parameterParameter value
maxDerivativeMaximum derivative order needed
Returns
Matrix [derivative_order][basis_function] of values
auto SFCGAL::NURBSCurve::binormal ( Parameter  parameter) const -> Point
override

Return the unit binormal vector at the given parameter.

Parameters
parameterParameter value in the curve's parameter domain.
Returns
Unit binormal vector at parameter.
auto SFCGAL::NURBSCurve::checkDimensionalConsistency ( ) const -> bool
protected

Check dimensional consistency across all control points.

Returns
true if all points have same XYZ and M dimensions
auto SFCGAL::NURBSCurve::closestPoint ( const Point &  point,
Parameter *  outParameter = nullptr 
) const -> Point
override

Project point onto the curve and return the closest point on the curve.

If outParameter is provided, it will be set to the parameter of the closest point.

Parameters
pointQuery point to project.
outParameterOptional output parameter pointer to receive the parameter of the closest point.
Returns
Closest point on the curve to point.
auto SFCGAL::NURBSCurve::computeArcLength ( const Parameter &  startParam,
const Parameter &  endParam,
const FT &  tolerance 
) const -> FT
protected

Compute arc length using adaptive Simpson quadrature.

Parameters
startParamStart parameter
endParamEnd parameter
toleranceIntegration tolerance
Returns
Arc length between parameters

Arc length computation using adaptive Simpson quadrature.

Integrates the speed function ||C'(t)|| over [startParam, endParam]: L = ∫[a,b] ||dC/dt|| dt

The adaptive approach subdivides intervals where Simpson's rule and its halving disagree by more than 15*tolerance, ensuring accurate results for curves with varying curvature.

auto SFCGAL::NURBSCurve::computeDerivatives ( const Parameter &  parameter,
unsigned int  maxOrder 
) const -> std::vector<Point>
protected

Compute curve derivatives up to specified order (Algorithm A4.2)

Parameters
parameterEvaluation parameter
maxOrderMaximum derivative order
Returns
Vector of derivatives [C(u), C'(u), C''(u), ...]
auto SFCGAL::NURBSCurve::computeParameters ( const std::vector< Point > &  points,
KnotMethod  method 
) -> std::vector<Parameter>
staticprotected

Compute parameter values for point sequence.

Parameters
pointsPoints to parameterize
methodParameterization method
Returns
Normalized parameter values [0,1]
auto SFCGAL::NURBSCurve::controlPointN ( size_t  index) -> Point &
override

Access control point for modification.

Parameters
indexControl point index (must be valid)
Returns
Non-const reference to control point
Exceptions
Exceptionif index out of bounds
auto SFCGAL::NURBSCurve::controlPointN ( size_t  index) const -> const Point &
override

Access control point for reading.

Parameters
indexControl point index (must be valid)
Returns
Const reference to control point
Exceptions
Exceptionif index out of bounds
auto SFCGAL::NURBSCurve::controlPoints ( ) const -> const std::vector<Point> &
inline

Get control points array.

Returns
Const reference to control points vector
auto SFCGAL::NURBSCurve::createBSpline ( const std::vector< Point > &  controlPoints,
unsigned int  degree 
) -> std::unique_ptr<NURBSCurve>
static

Create uniform B-spline with automatic knot generation.

Convenience method that creates a B-spline with uniformly spaced knots, suitable for most general-purpose curve creation. The knot vector is automatically generated using uniform parameterization [0,1].

Parameters
controlPointsControl points defining the curve shape
degreePolynomial degree (must be ≥ 0 and < controlPoints.size())
Returns
Non-rational NURBS curve with uniform knots and weights
Exceptions
Exceptionif controlPoints.empty() or degree ≥ controlPoints.size()
Note
This method generates a clamped knot vector with uniform spacing, which is the most common B-spline configuration for general use.
See also
fromBSpline() for explicit knot vector control
NURBSCurve(controlPoints, degree, KnotMethod::UNIFORM) for constructor equivalent
Example:
std::vector<Point> controlPoints = {{0,0}, {1,2}, {3,1}, {4,0}};
auto curve = NURBSCurve::createBSpline(controlPoints, 3); // Cubic B-spline
Generated knot vector structure:
  • Degree 2, 4 control points → knots: [0,0,0, 0.5, 1,1,1] (clamped)
  • Degree 3, 5 control points → knots: [0,0,0,0, 0.5, 1,1,1,1] (clamped)
auto SFCGAL::NURBSCurve::createCircularArc ( const Point &  center,
const FT &  radius,
const FT &  startAngle,
const FT &  endAngle,
const Point &  normal = Point(0, 0, 1),
KnotMethod  knotMethod = KnotMethod::UNIFORM 
) -> std::unique_ptr<NURBSCurve>
static

Create exact circular arc representation.

Parameters
centerArc center point
radiusArc radius (must be positive)
startAngleStart angle in radians
endAngleEnd angle in radians
normalNormal vector for 3D arcs (default Z-axis)
knotMethodKnot generation method for parameterization
Returns
Exact NURBS representation of circular arc
auto SFCGAL::NURBSCurve::curvature ( Parameter  parameter) const -> FT
override

Compute the curvature scalar at the given parameter.

Parameters
parameterParameter value in the curve's parameter domain.
Returns
Curvature κ at parameter.
auto SFCGAL::NURBSCurve::deBoorRational ( size_t  span,
const Parameter &  parameter 
) const -> Point
protected

Evaluate curve using De Boor's algorithm for rational curves.

Parameters
spanKnot span containing parameter
parameterParameter value
Returns
Point on curve
auto SFCGAL::NURBSCurve::degree ( ) const -> unsigned int
inlineoverride

Return the polynomial degree of the curve.

Returns
Degree (non-negative integer).
auto SFCGAL::NURBSCurve::derivative ( Parameter  parameter,
unsigned int  order = 1 
) const -> Point
override

Compute the derivative of the curve at the given parameter.

Parameters
parameterParameter value in the curve's parameter domain.
orderDerivative order (1 = first derivative). Defaults to 1.
Returns
The derivative vector (as a Point) of the specified order at parameter.
auto SFCGAL::NURBSCurve::dropM ( ) -> bool
override

Drop M coordinates from curve.

Returns
true if M coordinates were removed, false otherwise
auto SFCGAL::NURBSCurve::dropZ ( ) -> bool
override

Drop Z coordinates from curve.

Returns
true if Z coordinates were removed, false otherwise
auto SFCGAL::NURBSCurve::elevateDegree ( unsigned int  times = 1) const -> std::unique_ptr<NURBSCurve>

Elevate degree of curve (increases smoothness)

Parameters
timesNumber of degree elevations
Returns
Curve with elevated degree (shape unchanged)
Exceptions
Exceptionif elevation would create too many control points
auto SFCGAL::NURBSCurve::endTangent ( ) const -> const std::optional<Point> &
inline

Get end tangent constraint if specified.

Returns
Optional end tangent vector
auto SFCGAL::NURBSCurve::evaluate ( Parameter  parameter) const -> Point
override

Evaluate the curve at the given parameter and return the corresponding point in Cartesian space.

Parameters
parameterParameter value in the curve's parameter domain.
Returns
Point on the curve at parameter.
auto SFCGAL::NURBSCurve::findParameterByArcLength ( const FT &  targetLength,
const FT &  tolerance 
) const -> Parameter
protected

Find parameter corresponding to arc length using Newton-Raphson.

Parameters
targetLengthTarget arc length from start
toleranceConvergence tolerance
Returns
Parameter value at specified arc length
auto SFCGAL::NURBSCurve::findSpan ( const Parameter &  parameter) const -> size_t
protected

Find knot span containing parameter (Algorithm A2.1)

Parameters
parameterParameter value to locate
Returns
Knot span index
auto SFCGAL::NURBSCurve::fitCurve ( const std::vector< Point > &  points,
unsigned int  degree = 3,
FitMethod  fitMethod = FitMethod::INTERPOLATE,
KnotMethod  knotMethod = KnotMethod::UNIFORM,
EndCondition  endCondition = EndCondition::CLAMPED,
FT  tolerance = FT(1e-6),
size_t  maxControlPoints = 50 
) -> std::unique_ptr<NURBSCurve>
static

Unified curve fitting interface using FitMethod enum.

Parameters
pointsPoints to fit curve through or approximate
degreeTarget curve degree
fitMethodWhether to interpolate exactly or approximate within tolerance
knotMethodParameterization method for stability
endConditionBoundary conditions for interpolation
toleranceMaximum deviation for approximation (ignored for interpolation)
maxControlPointsMaximum control points for approximation (ignored for interpolation)
Returns
NURBS curve fitting the specified points
auto SFCGAL::NURBSCurve::fitPoints ( ) const -> const std::vector<Point> &
inline

Get original fit points if curve was created by fitting.

Returns
Original fit points (empty if not applicable)
auto SFCGAL::NURBSCurve::fitTolerance ( ) const -> FT
inline

Get fitting tolerance used.

Returns
Fit tolerance (0.0 for exact interpolation)
auto SFCGAL::NURBSCurve::frenetFrame ( Parameter  parameter) const -> std::tuple<Point, Point, Point>
override

Return the Frenet frame at the given parameter as (tangent, normal, binormal).

Parameters
parameterParameter value in the curve's parameter domain.
Returns
Tuple of (unit tangent, unit normal, unit binormal) at parameter.
auto SFCGAL::NURBSCurve::fromBezier ( const std::vector< Point > &  controlPoints) -> std::unique_ptr<NURBSCurve>
static

Create from Bezier control points.

Parameters
controlPointsBezier control points
Returns
NURBS curve with clamped knot vector [0,...,0,1,...,1]
auto SFCGAL::NURBSCurve::fromBSpline ( const std::vector< Point > &  controlPoints,
unsigned int  degree,
const std::vector< Knot > &  knots 
) -> std::unique_ptr<NURBSCurve>
static

Create NURBS curve from explicit B-spline parameters.

Constructs a non-rational B-spline (NURBS with uniform weights = 1.0) from complete B-spline specification. This is the low-level constructor for users who need precise control over the knot vector structure.

Parameters
controlPointsB-spline control points defining curve shape
degreePolynomial degree (must be ≥ 0 and < controlPoints.size())
knotsComplete knot vector (must satisfy: knots.size() = controlPoints.size() + degree + 1)
Returns
NURBS curve with uniform weights (all = 1.0)
Exceptions
Exceptionif parameters violate B-spline constraints
Note
Use this method when you have a specific knot vector from external sources (CAD files, mathematical specifications, etc.)
See also
createBSpline() for automatic knot generation with uniform spacing
Example:
std::vector<Point> controlPoints = {{0,0}, {1,1}, {2,0}};
std::vector<Knot> knots = {0, 0, 0, 1, 1, 1}; // Clamped quadratic
auto curve = NURBSCurve::fromBSpline(controlPoints, 2, knots);
auto SFCGAL::NURBSCurve::generateApproximationKnotVector ( const std::vector< Parameter > &  parameters,
unsigned int  degree,
size_t  numControlPoints 
) -> std::vector<Knot>
staticprotected

Generate knot vector for least-squares approximation.

Parameters
parametersParameter values for data points
degreeCurve degree
numControlPointsNumber of control points (m in Piegl & Tiller)
Returns
Knot vector optimized for approximation

Generate knot vector for NURBS approximation using geomdl method.

This is compute_knot_vector2 from geomdl which uses Piegl & Tiller Equation 9.68 from "The NURBS Book".

This method ensures that every knot span contains at least one parameter value, which produces better approximations than simple averaging.

auto SFCGAL::NURBSCurve::generateKnotVector ( const std::vector< Point > &  points,
unsigned int  degree,
KnotMethod  method 
) -> std::vector<Knot>
staticprotected

Generate knot vector using specified method.

Parameters
pointsReference points for parameterization
degreeCurve degree
methodKnot generation method
Returns
Generated knot vector
auto SFCGAL::NURBSCurve::generateKnotVectorForEndCondition ( const std::vector< Parameter > &  parameters,
unsigned int  degree,
EndCondition  endCondition 
) -> std::vector<Knot>
staticprotected

Generate knot vector for specific end conditions.

Parameters
parametersParameter values for interpolation points
degreePolynomial degree of the curve
endConditionType of end condition (clamped, natural, periodic)
Returns
Generated knot vector satisfying the end condition
auto SFCGAL::NURBSCurve::geometryType ( ) const -> std::string
override

Get the geometry type as string.

Returns
String representation of geometry type
auto SFCGAL::NURBSCurve::geometryTypeId ( ) const -> GeometryType
override

Get the geometry type identifier.

Returns
GeometryType enumeration value
auto SFCGAL::NURBSCurve::getCurveStatistics ( ) const -> std::map<std::string, double>

Get detailed curve statistics for debugging.

Returns
Map of curve properties and values
auto SFCGAL::NURBSCurve::insertKnot ( const Knot &  parameter,
unsigned int  times = 1 
) const -> std::unique_ptr<NURBSCurve>

Insert knot into curve without changing shape (Oslo algorithm)

Parameters
parameterKnot value to insert
timesNumber of insertions (limited by degree)
Returns
New curve with inserted knot
Exceptions
Exceptionif parameter outside knot span or too many insertions
auto SFCGAL::NURBSCurve::interpolateClampedCurve ( const std::vector< Point > &  points,
const std::vector< Parameter > &  parameters,
unsigned int  degree,
const std::vector< Knot > &  knots 
) -> std::vector<Point>
staticprotected

Interpolate points with clamped end conditions.

Parameters
pointsData points to interpolate through
parametersParameter values at each data point
degreePolynomial degree of interpolating curve
knotsKnot vector for interpolation
Returns
Control points for interpolating NURBS curve
auto SFCGAL::NURBSCurve::interpolateCurve ( const std::vector< Point > &  points,
unsigned int  degree = 3,
KnotMethod  knotMethod = KnotMethod::UNIFORM,
EndCondition  endCondition = EndCondition::CLAMPED 
) -> std::unique_ptr<NURBSCurve>
static

Interpolate points exactly with specified continuity.

Parameters
pointsPoints to interpolate through
degreeCurve degree (will be reduced if too high)
knotMethodParameterization method for stability
endConditionBoundary conditions
Returns
Interpolating NURBS curve
auto SFCGAL::NURBSCurve::interpolateNaturalCurve ( const std::vector< Point > &  points,
const std::vector< Parameter > &  parameters,
unsigned int  degree,
const std::vector< Knot > &  knots 
) -> std::vector<Point>
staticprotected

Interpolate with natural end conditions (minimal curvature)

Parameters
pointsData points to interpolate through
parametersParameter values at each data point
degreePolynomial degree of interpolating curve
knotsKnot vector for interpolation
Returns
Control points for natural interpolating curve
auto SFCGAL::NURBSCurve::interpolatePeriodicCurve ( const std::vector< Point > &  points,
unsigned int  degree,
KnotMethod  knotMethod 
) -> std::unique_ptr<NURBSCurve>
staticprotected

Create periodic interpolating curve.

Parameters
pointsData points to interpolate (first and last should be same)
degreePolynomial degree of curve
knotMethodKnot generation method for parameterization
Returns
Periodic NURBS curve interpolating the points
auto SFCGAL::NURBSCurve::is3D ( ) const -> bool
override

Check if curve is three-dimensional.

Returns
true if curve has Z coordinates, false otherwise
auto SFCGAL::NURBSCurve::isBezier ( ) const -> bool

Return true when this NURBS curve is represented in Bezier form.

A Bezier form here means the knot vector corresponds to one or more clamped Bezier segments (clamped ends with the appropriate multiplicities).

Returns
true if curve is in Bezier form, false otherwise
auto SFCGAL::NURBSCurve::isBSpline ( ) const -> bool

Return true when the curve is a non-rational B-spline (uniform weights).

This is true when no explicit weights are stored (all weights implicitly 1) or when all stored weights are effectively equal.

Returns
true if curve is a non-rational B-spline, false otherwise
auto SFCGAL::NURBSCurve::isEmpty ( ) const -> bool
override

Check if curve is empty.

Returns
true if curve has no control points, false otherwise
auto SFCGAL::NURBSCurve::isLinear ( ) const -> bool
override

Determine whether the curve is geometrically linear (represents a straight line).

Returns
true if the curve is linear, false otherwise.
auto SFCGAL::NURBSCurve::isMeasured ( ) const -> bool
override

Check if curve has measure coordinates.

Returns
true if curve has M coordinates, false otherwise
auto SFCGAL::NURBSCurve::isPeriodic ( ) const -> bool
override

True if the curve is periodic (periodic knot structure and matching end conditions).

Returns
true if periodic, false otherwise.
auto SFCGAL::NURBSCurve::isPlanar ( std::vector< FT > *  plane = nullptr) const -> bool
override

Check whether the curve is planar.

If plane is provided, fills it with plane coefficients.

Parameters
planeOptional pointer to a vector that, if provided, will be set to a plane representation (e.g., coefficients {A, B, C, D} for plane Ax + By + Cz + D = 0).
Returns
true if the curve is planar, false otherwise.
auto SFCGAL::NURBSCurve::isRational ( ) const -> bool
override

Check if curve uses non-uniform rational weights.

Returns
true if weights vary significantly from uniform
auto SFCGAL::NURBSCurve::join ( const Curve &  other,
Continuity  continuity = Continuity::C0,
FT  tolerance = FT(1e-6) 
) const -> std::unique_ptr<Curve>
override

Join this curve with other producing a single curve if they can be connected within the requested continuity and tolerance.

Parameters
otherCurve to join with.
continuityRequired continuity at the join point (default C0).
toleranceGeometric tolerance for accepting the join.
Returns
Unique pointer to the joined curve on success, or nullptr if join is not possible.
auto SFCGAL::NURBSCurve::knot ( size_t  index) const -> Knot

Get knot value at index.

Parameters
indexKnot index
Returns
Knot value
Exceptions
Exceptionif index out of bounds
auto SFCGAL::NURBSCurve::knotMultiplicity ( const Knot &  value,
const FT &  tolerance = FT(1e-10) 
) const -> unsigned int

Count multiplicity of knot value.

Parameters
valueKnot value to count
toleranceTolerance for knot equality
Returns
Number of occurrences of knot value
auto SFCGAL::NURBSCurve::knotVector ( ) const -> const std::vector<Knot> &
inline

Return the knot vector for this curve.

The returned reference is to the internal, non-decreasing knot vector.

Returns
Const reference to the knot vector
auto SFCGAL::NURBSCurve::length ( Parameter  from = Parameter(-1),
Parameter  to = Parameter(-1),
FT  tolerance = FT(1e-6) 
) const -> FT
override

Compute arc length between two parameters.

If from or to is omitted (default -1), the full curve domain is used. Integration is performed to within tolerance.

Parameters
fromStart parameter (use default to indicate domain start).
toEnd parameter (use default to indicate domain end).
toleranceTolerance for numerical integration.
Returns
Arc length between from and to.
auto SFCGAL::NURBSCurve::normal ( Parameter  parameter) const -> Point
override

Return the principal unit normal vector at the given parameter.

Parameters
parameterParameter value in the curve's parameter domain.
Returns
Unit normal vector at parameter.
auto SFCGAL::NURBSCurve::numControlPoints ( ) const -> size_t
inlineoverride

Get number of control points.

Returns
Control point count
auto SFCGAL::NURBSCurve::numKnots ( ) const -> size_t
inline

Get number of knots in vector.

Returns
Knot count
auto SFCGAL::NURBSCurve::operator= ( const NURBSCurve &  other) -> NURBSCurve &=default
default

Assignment operator.

Parameters
otherThe NURBSCurve to assign from
Returns
Reference to this NURBSCurve
auto SFCGAL::NURBSCurve::order ( ) const -> unsigned int
inline

Get curve order (degree + 1)

Returns
Curve order
auto SFCGAL::NURBSCurve::parameterAtLength ( FT  arcLength,
FT  tolerance = FT(1e-6) 
) const -> Parameter
override

Find the parameter corresponding to a given arc length measured from the start of the curve.

Parameters
arcLengthTarget arc length along the curve (measured from domain start).
toleranceTolerance for the inverse mapping solver.
Returns
Parameter value whose arc length from the curve start equals arcLength.
auto SFCGAL::NURBSCurve::parameterBounds ( ) const -> std::pair<Parameter, Parameter>
override

Return the parameter domain of the curve as [u_min, u_max].

Returns
Pair {u_min, u_max}.
auto SFCGAL::NURBSCurve::projectPointToCurve ( const Point &  point,
const FT &  tolerance = FT(1e-9),
unsigned int  maxIterations = 50 
) const -> std::pair<Point, Parameter>
protected

Project point onto curve using Newton's method.

Parameters
pointPoint to project
toleranceConvergence tolerance
maxIterationsMaximum iterations
Returns
Pair of (closest_point_on_curve, parameter_value)
auto SFCGAL::NURBSCurve::reduceDegree ( const FT &  tolerance = FT(1e-6)) const -> std::unique_ptr<NURBSCurve>

Reduce degree if possible without shape change.

Parameters
toleranceMaximum allowed deviation
Returns
Degree-reduced curve or nullptr if reduction impossible within tolerance
auto SFCGAL::NURBSCurve::refineKnotVector ( const std::vector< Knot > &  newKnots) const -> std::unique_ptr<NURBSCurve>

Refine knot vector by adding multiple knots.

Parameters
newKnotsSorted knots to insert
Returns
Refined curve (shape unchanged)
Exceptions
Exceptionif knots not properly ordered
auto SFCGAL::NURBSCurve::removeKnots ( const FT &  tolerance = FT(1e-6)) const -> std::unique_ptr<NURBSCurve>

Remove unnecessary knots while preserving shape.

Parameters
toleranceMaximum allowed deviation
Returns
Simplified curve with fewer knots
auto SFCGAL::NURBSCurve::reparameterizeByArcLength ( ) const -> std::unique_ptr<Curve>
override

Return a new Curve reparameterized by arc length (parameter runs proportionally to arc length).

Returns
New Curve owned pointer reparameterized by arc length.
auto SFCGAL::NURBSCurve::reverse ( ) const -> std::unique_ptr<Curve>
override

Return a new Curve representing this curve with reversed parameter direction.

Returns
Unique pointer to the reversed curve.
void SFCGAL::NURBSCurve::setControlPoint ( size_t  index,
const Point &  point 
)

Set individual control point with validation.

Parameters
indexControl point index
pointNew control point value
Exceptions
Exceptionif index invalid or dimension mismatch
void SFCGAL::NURBSCurve::setControlPoints ( const std::vector< Point > &  controlPoints)

Set all control points with validation.

Parameters
controlPointsNew control points
Exceptions
Exceptionif dimensionally inconsistent or degree constraint violated
void SFCGAL::NURBSCurve::setKnotVector ( const std::vector< Knot > &  knots)

Set knot vector with full validation.

Parameters
knotsNew knot vector (must satisfy NURBS constraints)
Exceptions
Exceptionif knot vector invalid for current curve parameters
void SFCGAL::NURBSCurve::setWeight ( size_t  index,
const FT &  weight 
)

Set weight at specified index.

Parameters
indexWeight index
weightNew weight value (must be positive)
Exceptions
Exceptionif index invalid or weight non-positive
void SFCGAL::NURBSCurve::setWeights ( const std::vector< FT > &  weights)

Set all weights with validation.

Parameters
weightsNew weights (must be positive and match control point count)
Exceptions
Exceptionif invalid weights provided
auto SFCGAL::NURBSCurve::simpsonRule ( const Parameter &  a,
const Parameter &  b 
) const -> FT
protected

Apply Simpson's rule over interval [a,b].

Parameters
aStart parameter
bEnd parameter
Returns
Simpson approximation of integral
auto SFCGAL::NURBSCurve::speedFunction ( Parameter  t) const -> FT
protected

Compute speed function ||C'(t)|| for arc length integration.

Parameters
tParameter value
Returns
Magnitude of derivative vector at parameter t
auto SFCGAL::NURBSCurve::split ( Parameter  parameter) const -> std::pair<std::unique_ptr<Curve>, std::unique_ptr<Curve>>
override

Split the curve at parameter into two curves [domain_start, parameter] and [parameter, domain_end].

Parameters
parameterParameter at which to split the curve.
Returns
Pair of unique_ptrs to the left and right subcurves.
auto SFCGAL::NURBSCurve::startTangent ( ) const -> const std::optional<Point> &
inline

Get start tangent constraint if specified.

Returns
Optional start tangent vector
auto SFCGAL::NURBSCurve::subcurve ( Parameter  from,
Parameter  to 
) const -> std::unique_ptr<Curve>
override

Extract a subcurve between parameters from and to (inclusive of domain interval).

Parameters
fromStart parameter of the subcurve.
toEnd parameter of the subcurve.
Returns
Unique pointer to the extracted subcurve.
void SFCGAL::NURBSCurve::swapXY ( )
override

Swap the X and Y coordinates of all control points and any stored fit data.

auto SFCGAL::NURBSCurve::tangent ( Parameter  parameter) const -> Point
override

Return the unit tangent vector at the given parameter.

Parameters
parameterParameter value in the curve's parameter domain.
Returns
Unit tangent vector at parameter.
auto SFCGAL::NURBSCurve::toLineString ( unsigned int  numSegments = 32) const -> std::unique_ptr<LineString>
override

Convert the curve to a LineString by sampling numSegments uniformly in parameter space.

Parameters
numSegmentsNumber of segments (default 32) to use for the polyline approximation.
Returns
LineString approximating the curve.
auto SFCGAL::NURBSCurve::toLineStringAdaptive ( FT  tolerance = FT(1e-3),
unsigned int  minSegments = 8,
unsigned int  maxSegments = 256 
) const -> std::unique_ptr<LineString>
override

Convert the curve to a LineString using adaptive subdivision until the polyline approximates the curve within tolerance, respecting minSegments and maxSegments bounds.

Parameters
toleranceMaximum allowed deviation between curve and polyline.
minSegmentsMinimum number of segments to produce.
maxSegmentsMaximum number of segments to produce.
Returns
LineString approximating the curve within tolerance.
auto SFCGAL::NURBSCurve::torsion ( Parameter  parameter) const -> FT
override

Compute the torsion scalar at the given parameter.

Parameters
parameterParameter value in the curve's parameter domain.
Returns
Torsion τ at parameter.
auto SFCGAL::NURBSCurve::validateData ( ) const -> std::pair<bool, std::string>

Comprehensive NURBS data validation.

Returns
Pair of (is_valid, error_description)
auto SFCGAL::NURBSCurve::validateNURBSData ( const std::vector< Point > &  controlPoints,
const std::vector< FT > &  weights,
unsigned int  degree,
const std::vector< Knot > &  knots 
) -> std::pair<bool, std::string>
staticprotected

Validate complete NURBS data structure.

Parameters
controlPointsControl points to validate
weightsWeights to validate
degreeDegree to validate
knotsKnot vector to validate
Returns
Pair of (is_valid, detailed_error_message)
auto SFCGAL::NURBSCurve::weight ( size_t  index) const -> FT
override

Get weight at specified index.

Parameters
indexWeight index
Returns
Weight value (1.0 if using uniform weights)
Exceptions
Exceptionif index out of bounds
auto SFCGAL::NURBSCurve::weights ( ) const -> const std::vector<FT> &
inline

Get weights array.

Returns
Const reference to weights vector

Member Data Documentation

std::vector<Point> SFCGAL::NURBSCurve::_controlPoints
protected

Control points in curve space.

unsigned int SFCGAL::NURBSCurve::_degree {0}
protected

Polynomial degree of the NURBS curve (non-negative).

A degree of 0 represents a point; the curve order is degree + 1. Defaults to 0.Polynomial degree

std::optional<Point> SFCGAL::NURBSCurve::_endTangent
protected

End tangent constraint.

std::vector<Point> SFCGAL::NURBSCurve::_fitPoints
protected

Original points if fitted.

FT SFCGAL::NURBSCurve::_fitTolerance {FT(0)}
protected

Fitting tolerance used.

std::vector<Knot> SFCGAL::NURBSCurve::_knotVector
protected

Non-decreasing knot sequence.

std::optional<Point> SFCGAL::NURBSCurve::_startTangent
protected

Start tangent constraint.

std::vector<FT> SFCGAL::NURBSCurve::_weights
protected

Weights (empty = all 1.0)