orientation.byScreenAlignment edit page

the orientation implied by two frames being aligned on screen

Data in frA is drawn under frA.how2plot and data in frB under frB.how2plot. If the two were plotted and seen to coincide, that assertion pins the rotation between the frames: a point sitting at v in frA sits at ori*v in frB.

This is an inference from a user assertion, not a geometric fact about the two bases. It reads how2plot and never touches basis, so it can be used to establish a basis - see gridLayout.assumedFor. Once a basis has been set from it, transformationMatrix reproduces the same rotation from the bases alone, which is the invariant worth asserting in a test.

Description

A point at v renders at inv(fr.how2plot.rot)*v in screen coordinates. "Aligned on screen" is therefore

inv(frA.how2plot.rot) * vA == inv(frB.how2plot.rot) * vB

which rearranges to vB = frB.how2plot.rot * inv(frA.how2plot.rot) * vA.

Syntax

ori = orientation.byScreenAlignment(imgFrame,specimenFrame.default)
ori.frameRight   % frA, the source
ori.frameLeft    % frB, the target

Input

frA referenceFrame, the source
frB referenceFrame, the target

Output

ori orientation taking coordinates in frA to coordinates in frB

See also

gridLayout referenceFrame.transformationMatrix plottingConvention