Operands of different dimensions read the dimensions both of them have, see the section called “Operands of Different Dimensions”.
We present next the functions that compute distance operations for temporal poses and temporal pose chains. Notice that for these operations only the point component is considered, not the orientation. A temporal pose chain is measured by the temporal pose its composition gives, tpose(tposechain), which is a step function for a chain of more than one link.
Return the smallest distance ever
{geo,pose,tpose,stbox} |=| {geo,pose,tpose,stbox} → float
{geo,posechain,tposechain,stbox} |=| {geo,posechain,tposechain,stbox} → float
SELECT tpose '[Pose(Point(2 2), 0.3)@2001-01-01, Pose(Point(2 2), 0.7)@2001-01-02]' |=| geometry 'Linestring(50 50,55 55)'; -- 67.88225099390856 SELECT tpose '[Pose(Point(2 2), 0.3)@2001-01-01, Pose(Point(2 2), 0.7)@2001-01-02]' |=| pose 'Pose(Point(1 1), 0.5)'; -- 1.4142135623730951 SELECT tpose '[Pose(Point(1 1), 0.3)@2001-01-01, Pose(Point(1 1), 0.5)@2001-01-03]' |=| pose 'Pose(Point(2 2), 0.2)'; -- 1.4142135623730951 SELECT tpose '[Pose(Point(1 1), 0.3)@2001-01-01, Pose(Point(1 1), 0.5)@2001-01-03]' |=| geometry 'Linestring(2 2,2 1,3 1)'; -- 1
The operator |=| can be used for doing nearest neightbor searches using GiST or SP-GiST indexes (see the section called “Indexing”).
Return the instant of the first temporal pose at which the two arguments are at the nearest distance
nearestApproachInstant({geo,pose,tpose},{geo,pose,tpose}) → tpose
nearestApproachInstant({geo,posechain,tposechain},{geo,posechain,tposechain}) → tposechain
SELECT asText(nearestApproachInstant(tpose '[Pose(Point(2 2), 0.3)@2001-01-01, Pose(Point(2 2), 0.7)@2001-01-02]', geometry 'Linestring(50 50,55 55)')); -- Pose(POINT(2 2),0.3)@2001-01-01 SELECT asText(nearestApproachInstant(tpose '[Pose(Point(2 2), 0.3)@2001-01-01, Pose(Point(2 2), 0.7)@2001-01-02]', pose 'Pose(Point(1 1), 0.5)')); -- Pose(POINT(2 2),0.3)@2001-01-01
Return the line connecting the nearest approach point
shortestLine({geo,pose,tpose},{geo,pose,tpose}) → geometry
shortestLine({geo,posechain,tposechain},{geo,posechain,tposechain}) → geometry
The function will only return the first line that it finds if there are more than one.
SELECT ST_AsText(shortestLine(tpose '[Pose(Point(2 2), 0.3)@2001-01-01, Pose(Point(2 2), 0.7)@2001-01-02]', geometry 'Linestring(50 50,55 55)')); -- LINESTRING(2 2,50 50) SELECT ST_AsText(shortestLine(tpose '[Pose(Point(2 2), 0.3)@2001-01-01, Pose(Point(2 2), 0.7)@2001-01-02]', pose 'Pose(Point(1 1), 0.5)')); -- LINESTRING(2 2,1 1)
Return the temporal distance
tDistance({geompoint,geogpoint,pose,tpose},{geompoint,geogpoint,pose,tpose}) → tfloat
tDistance({geompoint,geogpoint,posechain,tposechain},{geompoint,geogpoint,posechain,tposechain}) → tfloat
{geompoint,geogpoint,pose,tpose} <-> {geompoint,geogpoint,pose,tpose} → tfloat
{geompoint,geogpoint,posechain,tposechain} <-> {geompoint,geogpoint,posechain,tposechain} → tfloat
SELECT round(tpose '[Pose(Point(1 1), 0.3)@2001-01-01, Pose(Point(1 1), 0.5)@2001-01-03]' <-> pose 'Pose(Point(2 2), 0.2)', 6); -- [1.414214@2001-01-01, 1.414214@2001-01-03] SELECT round(tpose '[Pose(Point(1 1), 0.3)@2001-01-01, Pose(Point(1 1), 0.5)@2001-01-03]' <-> geometry 'Point(50 50)', 6); -- [69.296465@2001-01-01, 69.296465@2001-01-03] SELECT round(tpose '[Pose(Point(1 1), 0.3)@2001-01-01, Pose(Point(2 2), 0.5)@2001-01-03]' <-> tpose '[Pose(Point(1 2), 0.3)@2001-01-02, Pose(Point(2 1), 0.5)@2001-01-04]', 6); -- [0.707107@2001-01-02, 0.5@2001-01-02 12:00:00, 0.707107@2001-01-03] SELECT asText(round(tposechain '[PoseChain(Pose(Point(0 0),0), Pose(Point(1 0),0))@2001-01-01, PoseChain(Pose(Point(4 0),0), Pose(Point(1 0),0))@2001-01-05]' <-> geometry 'Point(1 0)', 6)); -- Interp=Step;[0@2001-01-01, 4@2001-01-05]