A pose chain states its links, and this section holds what only a chain answers: how it is built from poses, how many links it holds, which pose a link is, and how the whole chain composes back into the single pose it denotes.
Construct a pose chain from an array of poses ordered from the outermost frame inwards
posechain(pose[]) → posechain
SELECT asEWKT(posechain(ARRAY[pose 'Pose(Point(0 0),0)', pose 'Pose(Point(1 0),0)'])); -- PoseChain(Pose(POINT(0 0),0),Pose(POINT(1 0),0))
Convert a pose into a pose chain of a single link
posechain(pose) → posechain
SELECT asEWKT(posechain(pose 'SRID=3812;Pose(Point(1 2),0.5)')); -- SRID=3812;PoseChain(Pose(POINT(1 2),0.5))
Return the pose of a frame the chain defines, read in the outer frame of the chain
pose(posechain) → pose pose(posechain,integer) → pose
Every instant holds the pose the whole chain composes to, which is where its innermost frame sits in the frame of the chain. The result is a step function: composing a chain multiplies the rotations of its links, so the pose of the chain interpolated between two instants is not the pose interpolated between the two composed poses, and a linear result would answer a pose the chain never holds. A chain of one link composes to itself, and there the interpolation of the argument carries over unchanged.
With one argument the whole chain is composed, giving the pose of its innermost frame. With two the first n links are composed, giving the pose of the frame the n-th link defines, that is, where that joint of the chain sits.
SELECT asEWKT(pose(posechain 'PoseChain(Pose(Point(0 0),0),Pose(Point(1 0),0), Pose(Point(1 0),0))')); -- Pose(POINT(2 0),0) SELECT asEWKT(pose(posechain 'PoseChain(Pose(Point(0 0),0),Pose(Point(1 0),0), Pose(Point(1 0),0))', 2)); -- Pose(POINT(1 0),0)
Return a pose chain with a pose appended as its innermost link
appendPose(posechain,pose) → posechain
The pose is read in the frame the last link of the chain defines, so it carries neither an SRID nor the geodetic marker.
SELECT asEWKT(appendPose(posechain 'PoseChain(Pose(Point(0 0),0))', pose 'Pose(Point(1 0),0)')); -- PoseChain(Pose(POINT(0 0),0),Pose(POINT(1 0),0))
Return the number of links of a pose chain
numPoses(posechain) → integer
SELECT numPoses(posechain 'PoseChain(Pose(Point(0 0),0),Pose(Point(1 0),0), Pose(Point(2 0),0))'); -- 3
Return the links of a pose chain
startPose(posechain) → pose endPose(posechain) → pose poseN(posechain,integer) → pose poses(posechain) → pose[]
A link is returned as it is stored, that is, in the frame the link before it defines. Where that frame sits in the outer frame of the chain is what pose(posechain,integer) answers. The function poseN returns NULL if the chain has fewer links than the number given.
SELECT asEWKT(startPose(posechain 'SRID=3812;
PoseChain(Pose(Point(0 0),0),Pose(Point(1 0),0))'));
-- SRID=3812;Pose(POINT(0 0),0)
SELECT asEWKT(endPose(posechain 'PoseChain(Pose(Point(0 0),0),Pose(Point(1 0),0))'));
-- Pose(POINT(1 0),0)
SELECT asEWKT(poseN(posechain 'PoseChain(Pose(Point(0 0),0),Pose(Point(1 0),0))', 2));
-- Pose(POINT(1 0),0)
SELECT asEWKT(poses(posechain 'PoseChain(Pose(Point(0 0),0),Pose(Point(1 0),0))'));
-- {"Pose(POINT(0 0),0)","Pose(POINT(1 0),0)"}
Return the number of links every value of a temporal pose chain holds
numPoses(tposechain) → integer
The number is the same at every instant, so one instant answers for the whole value.
SELECT numPoses(tposechain 'PoseChain(Pose(Point(0 0), 0), Pose(Point(10 0), 0))@2001-01-01'); -- 2