feat(std/transform): 2D transforms and propagation (step 3a of #89) #780
No reviewers
Labels
No labels
loop
queue/failed
queue/queued
ready
status/parked
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
torbscript/language!780
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/779-std-transform-2d"
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?
Adds the package
std/transform(2D half of #89), importing onlystd/core,std/number,std/linearandstd/ecs.Transform2<Scalar: Real = Float>(translation, rotation, scale;Equals, Show;identity) withcomposed(child),inverse(): Self?(None on a zero scale),interpolated(toward:, by:)(rotation the short way, including the pi seam) andtoMatrix3().GlobalTransform2<Scalar>holding aMatrix3(a non-uniform parent scale over a rotated child shears, which a decomposed transform cannot hold), withidentity,transformedPoint,transformedDirection.propagate(locals, var globals, parents, order): one pass over thedepthOrderlist; global = parent's global matrix times owntoMatrix3(); an entity without parent, or whose parent has no global, uses its own matrix. Plain function overStore<Transform2>/Store<GlobalTransform2>, registered by the program in its ownSchedule(pattern indocs/standard-library/transform.md).FloatandFixed.Tests:
std/transform/tests(26 tests: arithmetic, reverse-order chain, non-uniform root scale with rotated child, no parent, parent without global, Float run, hand-computed Fixed chain); conformancetransform-propagate(rotate-root + propagate system in aSchedule, four frames) andtransform-propagate-cycle(panics throughdepthOrder).Docs:
docs/standard-library/transform.md, index and ecs.md entries, regeneratedskills/, landed notes indocs/design/ECS.md(header, sections 7, 11, 13).Deviations and open points:
composed(child), notcomposed(with:):withis a keyword and cannot be a parameter name.composedis exact for a uniform parent scale, documented as such.Fixedtrig is inexact (sine(0) is -1 raw), so rotation-dependent test values useisCloseTowith 66 raw units; the conformance output is deterministic integers.--update-budgetsdid not run..allocationsfortransform-propagatecomes from the first CI run (the cycle program has none, likeecs-parent-cycle);.expectedwas generated from the VM.torb docs check docs --no-nativereports 14 problems in other pages (nightly vs. main diagnostic wording), none in the touched pages.Closes #779
Refs #89
std/transform2D:Transform2,GlobalTransform2and propagation (step 3a of #89) #779Review of
e234aea. CI is green for this head, but green here does not cover the new conformance program (see 1).Checklist
FloatandFixedruns.composed,interpolated(short way over the seam) andpropagate(parent global times own matrix, depth order fromdepthOrder, cycle panics there) match the PR body and #779 R1-R5.composed(child:)instead ofcomposed(with:)is a justified deviation (withis a keyword).std/linearandstd/ecs.skills/, ECS.md notes; pdisc green.Findings
tests/conformance/transform-propagate.allocationsis missing. The program exits 0 and has a leak run, so pertests/conformance/README.md("A program with a leak run and no.allocationsfile fails and prints its count") tier B fails on it. Tier B was skipped on this PR by design (ci.yml: it runs on a PR only whencompiler/src/ir,compiler/src/backend,runtime/,tools/or.forgejo/change), so this PR's CI can never produce the number the body says it waits for, and nothing here ran the native leg. Tier B runs on every push tomain, so merging as is turnsmainred. Every non-panickingecs-*program (ecs-data,ecs-schedule) carries its.allocations. Please obtain the count from a linux x86_64 run with a C compiler (sh tools/conformance.sh --filter transform-propagate --update-budgets, or a CI run where tier B is active) and commit the file in this PR, and note in the PR body that the native leg and the leak run were green. If the byte-for-byte VM/native agreement of.expectedfails there, regenerate it from that run.Non-blocking
Transform2.inversedoc: only the example is given; state next to the "uniform scale" caveat (as incomposed) that with a non-uniform scale and a nonzero rotation the result is not the exact inverse (GlobalTransform2matrices are, viaMatrix3).I will re-check the new
.allocationsfile and the PR body on the next head; the rest is approved as it stands.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.