Name

ST_Weights — Returns the weight array of a rational NURBS curve.

Synopsis

float8[] ST_Weights(geometry nurbscurve);

Beschreibung

Returns the weight values of a rational NURBS curve as an array of double precision values. Weights control the influence of each control point on the curve shape. Higher weights pull the curve closer to the corresponding control point.

Returns NULL if the curve has no weights (non-rational B-spline) or if the input is NULL. Raises an error if the input is not a NURBS curve.

Availability: 3.7.0

Beispiele

-- Get weights from a rational NURBS curve
SELECT ST_Weights(ST_MakeNurbsCurve(2, 'LINESTRING(0 0, 5 10, 10 0)'::geometry, ARRAY[1.0, 2.0, 1.0]));
-- Result: {1,2,1}

-- Check if a curve has uniform weights
SELECT ST_Weights('NURBSCURVE(2, (0 0, 5 10, 10 0))'::geometry);
-- Result: NULL (non-rational curve)