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

Examples

This example returns the number of control points.

Code
SELECT ST_NumControlPoints('NURBSCURVE(2, (0 0, 5 10, 10 0))'::geometry);
Output
3
Figure
Geometry figure for visual-st-numcontrolpoints-01

This example verifies that a curve has enough control points for its degree.

Code
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;
Output
t
Figure
Geometry figure for visual-st-numcontrolpoints-02