Name

ST_MakeNurbsCurve — Creates a NURBS (Non-Uniform Rational B-Spline) curve from control points, optional weights, and optional knot vector.

Synopsis

geometry ST_MakeNurbsCurve(integer degree, geometry control_points, float8[] weights, float8[] knots);

Descrição

Creates a NURBS (Non-Uniform Rational B-Spline) curve geometry from the specified parameters. NURBS curves are smooth parametric curves that provide precise control over curve shape through control points, weights, and knot values.

The degree parameter specifies the polynomial degree of the curve (must be between 1 and 10). Higher degrees produce smoother curves.

The control_points must be a LINESTRING geometry defining the control polygon. The number of control points must be at least degree + 1.

The optional weights array assigns a weight to each control point. All weights must be positive. If NULL or omitted, uniform weights (1.0) are used, resulting in a non-rational B-spline.

The optional knots array defines the parameter space. If NULL or omitted, a uniform clamped knot vector is automatically generated. If provided, the knot vector must have exactly (npoints + degree + 1) elements and must be non-decreasing.

Availability: 3.7.0

Exemplos

-- Create a degree-2 NURBS curve with uniform weights
SELECT ST_MakeNurbsCurve(2, 'LINESTRING(0 0, 5 10, 10 0)'::geometry);

-- Create a rational NURBS curve with custom weights
SELECT ST_MakeNurbsCurve(2, 'LINESTRING(0 0, 5 10, 10 0)'::geometry, ARRAY[1.0, 2.0, 1.0]);

-- Create a NURBS curve with custom weights and knots
SELECT ST_MakeNurbsCurve(2, 'LINESTRING(0 0, 5 10, 10 0)'::geometry, ARRAY[1.0, 2.0, 1.0], ARRAY[0,0,0,1,1,1]);