Distance Operations

A temporal rigid geometry in two dimensions reads a geometry or a temporal point with Z in two dimensions, see the section called “Operands of Different Dimensions”. Two temporal rigid geometries of different dimensions raise an error, since the shadow in the plane of a body turning in three dimensions is not a rigid body.

The distance functions compute the distance between the body of a temporal rigid geometry and a geometry, a temporal point, or the body of another temporal rigid geometry. The body at an instant is the reference geometry moved and turned by the pose at that instant.

The values of a temporal distance are exact. When a body turns, the distance between two instants does not change linearly, so the temporal distance also has an instant at each minimum and maximum of the distance. Thus the nearest approach distance and the nearest approach instant are exact.

The reference geometry may be a polygon of any shape, holes included. It is read as an exact cover of convex pieces whose vertices are its own and whose union is its area, so the distance of the body is the least distance of a piece, and it is 0 exactly where a piece meets the other argument. A polygon of the other argument may also have any shape and holes: the distance to it is 0 while the body has a point in it, and otherwise the distance to its rings. A geometry collection, nested ones included, is read as its members, as a multi-geometry is. Two temporal rigid geometries may both turn in the same segment, whatever the shape of their bodies. The distance of a temporal rigid geometry in three dimensions is not yet supported, and neither is the distance to a curve.

SELECT tDistance(trgeometry 'Polygon((0 0,4 0,4 4,2 1,0 4,0 0));
  Pose(Point(0 0),0)@2001-01-01', geometry 'Point(7 3)');
-- 3@2001-01-01