[Doc] Clarifications on the TRSSF canonical order #40
Labels
No labels
Priority-Medium
Type-Defect
auto-migrated
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: john/context-free#40
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In the wiki doc on shape adjustment, the doc showed an example
and in the text below it explained that in this case the adjustment order is to translate first, then rotate, and so on.
I was a bit confused by the text, because if we translate
barfirst to(1, 2), a rotation would move it around the origin, not(1, 2). The same logic goes to sizing, where it would move to(2, 1).Fundamentally, the confusion is on the order of applying the affine transformation. If the affine matrix for the translate operation is T, and the R for rotate, then the behavior of CF suggests
T * R (shape), while the text saysR * T(shape).I dug around the source code to see how this behavior is implemented. The
ASTmodification::makeCanonicalfunction inastexpression.cppwould sort all transformations in canonical order, whileASTmodTerm::evaluatewould then apply those transformations. The code would callm.m_transform.premultiply(T)where I believemis the existing affine transformation andTis the shape transformation. When combined with the canonical order, I believe we are concatenating the transformation matrix aswhere
Mis the existing/external transformation.While the order of concatenating the shape transformations is indeed TRSSF, when we do it step by step, we do need to apply the transformations in the reverse order, i.e.
F S S R T.I constructed the following example to illustrate the behavior.
Would like to use your help to clarify if my understanding is correct.
I am happy to send over a small PR to update the wiki.