The metadata or ephemeris we have for the flight includes the bearing, pitch, and roll of the UAS, in addition to its elevation and location:

To translate these ephemeris into PostGIS terms, we'll assume the following:
- 90 degrees minus the pitch is equivalent to ST_RotateX
- The negative roll is equivalent to ST_RotateY
- 90 degrees minus the bearing is equivalent to ST_RotateZ
In order to perform our analysis, we require external functions. These functions can be downloaded from https://github.com/smathermather/postgis-etc/tree/master/3D.
We will use patched versions of ST_RotateX, ST_RotateY (ST_RotateX.sql, and ST_RotateY.sql), which allow us to rotate geometries around an input point, as well as a function for calculating our field of view, pyramidMaker.sql. Future versions of PostGIS will include these versions of ST_RotateX and ST_RotateY built in. We have another function, ST_RotateXYZ, which is built upon these and will also simplify our code by allowing us to specify three axes at the same time for rotation.
For the final step, we'll need the capacity to perform volumetric intersection (the 3D equivalent of intersection). For this, we'll use volumetricIntersection.sql, which allows us to just return the volumetric portion of the intersection as a triangular irregular network (TIN).
We will install the functions as follows:
psql -U me -d postgis_cookbook -f ST_RotateX.sql psql -U me -d postgis_cookbook -f ST_RotateY.sql psql -U me -d postgis_cookbook -f ST_RotateXYZ.sql psql -U me -d postgis_cookbook -f pyramidMaker.sql psql -U me -d postgis_cookbook -f volumetricIntersection.sql