This topic describes the ST_CurvatureRadius function. This function calculates the rotation radius of a trajectory at each intermediate point and returns an array of floating-point numbers.
Syntax
double precision[] ST_CurvatureRadius(trajectory traj, boolean hasdirection default false);
Parameters
Parameter | Description |
---|---|
traj | The trajectory object. |
hasdirection | Specifies whether to calculate the direction of rotation of the trajectory. If the direction of rotation of a trajectory is calculated, a negative value is returned when the trajectory is rotated in the counterclockwise direction. |
Description
This function calculates the rotation radius of a trajectory at each intermediate point. If a trajectory has n points, the number of intermediate points of the trajectory is the difference between n and 2. If the trajectory moves along a straight line or stays unchanged at an intermediate point, the rotation radius of the trajectory is infinite. The smaller the rotation radius of the trajectory, the sharper the curve is.
Examples
SELECT ST_CurvatureRadius(ST_MakeTrajectory('LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8)'));
st_curvatureradius
-----------------------
{5,Infinity,Infinity}
(1 row)
SELECT ST_CurvatureRadius(ST_MakeTrajectory('LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8, 6 8, 0 8, 0 0)'));
st_curvatureradius
-------------------------------------------
{5,Infinity,Infinity,Infinity,Infinity,5}
(1 row)
SELECT ST_CurvatureRadius(ST_MakeTrajectory('LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8, 6 8, 0 8, 0 0)'), true);
st_curvatureradius
--------------------------------------------
{5,Infinity,Infinity,Infinity,Infinity,-5}
(1 row)
SELECT ST_CurvatureRadius(ST_MakeTrajectory('LINESTRING(0 0, 0 8, 6 8, 12 8, 12 8, 6 8, 0 8, 0 0, 0 4, 3 4)'), true);
st_curvatureradius
--------------------------------------------------
{5,Infinity,Infinity,Infinity,Infinity,-5,0,2.5}
(1 row)