Name

ST_NumControlPoints — Returns the number of control points in a NURBS curve.

Synopsis

integer ST_NumControlPoints(geometry nurbscurve);

Description

Returns the number of control points in a NURBS curve. The number of control points must be at least (degree + 1) for a valid NURBS curve.

Raises an error if the input is not a NURBS curve. Returns NULL if the input is NULL.

Availability: 3.7.0

Exemples

-- Get the number of control points
SELECT ST_NumControlPoints('NURBSCURVE(2, (0 0, 5 10, 10 0))'::geometry);
-- Result: 3

-- Verify curve has enough control points for its degree
SELECT ST_NumControlPoints(curve) 
>= ST_Degree(curve) + 1 AS valid
FROM (SELECT 'NURBSCURVE(2, (0 0, 5 10, 10 0))'::geometry AS curve) AS t;
-- Result: true