This topic describes the ST_ComputeFrustum function. This function returns the view frustum of a viewpoint.
Syntax
meshgeom ST_ComputeFrustum(cstring viewpoint);Parameters
Parameter | Description |
viewpoint | The information about the viewpoint. The value is in the JSON format. |
The following table describes the fields in the JSON value.
Field | Description | Valid values |
x | The x-coordinate of the viewpoint. Default value: 0. | (-inf, +inf) |
y | The y-coordinate of the viewpoint. Default value: 0. | (-inf, +inf) |
z | The z-coordinate of the viewpoint. Default value: 0. | (-inf, +inf) |
h | The height of the viewpoint. Default value: 0. | [0, +inf) |
azimuth | The angle that rotates in the clockwise direction starting from the north (y-axis forward direction) to the viewing point. Default value: 0. Unit: degrees. | [-180, 180] |
pitch | The pitch angle, which indicates the angle between the viewing point and the XOY plane. If the viewing point is above the XOY plane, the pitch angle is positive. Otherwise, the pitch angle is negative. Default value: 0. Unit: degrees. | [-90, 90] |
distance | The maximum viewing distance. A larger value indicates a wider coverage of the view frustum. Default value: 100. | (0, +inf) |
horizontalFov | The horizontal FOV. Default value: 90. Unit: degrees. | (0, 180) |
verticalFov | The vertical FOV. Default value: 60. Unit: degrees. | (0, 180) |
depthMapSize | The size of the depth map. A larger size indicates a finer view frustum. Default value: 128. | (0, 2048] |
Description
This function calculates the view frustum of the given viewpoint.
Examples:
View frustum (top view)

View frustum (side view)

Examples
SELECT ST_NumPatches(ST_ComputeFrustum('{"x" : 2938, "y" : 750, "z" : 90, "h" : 1.8, "azimuth" : 90, "pitch" : -35, "horizontalFov" : 90, "verticalFov" : 60, "distance" : 600, "depthMapSize" : 128}'));
--------
32766The return value indicates that the view frustum consists of 32,766 3D triangles.