Skip to content

Make the tangential frame traceable and give the rotation a transform turns by one public definition - #149

Open
1-Bort-1 wants to merge 1 commit into
mainfrom
agent/148-public-traceable-geometry-helpers-symbol
Open

1-Bort-1 wants to merge 1 commit into
mainfrom
agent/148-public-traceable-geometry-helpers-symbol

Conversation

@1-Bort-1

Copy link
Copy Markdown
Member

SymbolicAWEModels keeps its own copies of three KiteGeometry rules because KiteGeometry's were private or failed on symbolic inputs. This makes all three public, so it can drop the copies.

The tangential frame at a position now works on ModelingToolkit's symbolic numbers. Before, its zenith check branched on a comparison and threw TypeError: non-boolean (Num) used in boolean context. It now picks the zenith frame with ifelse, and gives the same result as before for plain numbers.

The rotation a transform turns its members by now has a function of its own, which reports it without turning anything. Turning a transform applies that rotation and returns it. Placing and repositioning both go through it, so there is one definition. A tool can now turn its velocities with the pose using the same rotation the positions got. The Rodrigues rotation about an axis is public as well.

# before: SAM rebuilt it from four KiteGeometry internals
R = rotate_frame(Mat3(I), min_rotation(dir_before, dir_after)...)
# after
R = KiteGeometry.turn_rotation(pose, transforms, transform)   # without turning
R = KiteGeometry.turn!(pose, transforms, transform)           # turns, returns it

Decisions I made:

  • turn! is public too and returns the rotation. In a chained system a later transform's rotation depends on where the earlier ones left its base, so a tool that turns velocities needs each rotation in order. Calling turn! in a loop gives it that.
  • turn! takes (pose, transforms, transform) and finds the base itself, instead of being handed a base position. Placing used to pass the authored base position. It now reads the base point it has just shifted onto that position, which differs only by rounding.
  • A transform is now turned by one combined rotation matrix instead of two Rodrigues rotations one after the other. The result is the same rotation, and the existing placement tests pass unchanged at their 1e-9 tolerance.
  • The traced test needs the real Symbolics.Num, so Symbolics joins the test environment. It adds Symbolics' dependency tree to both tracked manifests. On 1.13 the resolve also updated the standard-library jll pins to Julia 1.13.4's versions and fixed a stale KiteGeometry version entry. No existing package moved otherwise.
  • The internal choose helper (ifelse per element) now builds a typed SVector. Its old map gave SVector{3, Any} on mixed Float64/Num inputs, and cross refused that type.

Only the tangential frame is claimed symbolic. The rotation about an axis is made public as it stands; it is not tested on symbolic inputs.

Verification

  • Reproduced first: main's calc_R_t_to_w([x, y, z]) on Symbolics.Num throws TypeError: non-boolean (Num) used in boolean context
  • test/test-transforms.jl new sets — "the tangential frame of a symbolic position is the numeric one" (compiled with build_function, compared at a generic point, the zenith and near it, atol 1e-12) and "turn! moves each transform's members by the rotation turn_rotation gives": red before (TypeError / turn_rotation undefined), green after, 40/40
  • Local full suite on this head (test/runtests.jl, Julia 1.13.4): 1027/1027 pass · local CI mirror: PASS (3 min) · GitHub CI: runs on push
  • Docs build clean (Documenter's existing size warning on structure.md only) · REUSE lint clean · up to date with main
  • Benchmark: n/a. Placing and repositioning run once per pose change, not per simulation step.
  • Risk: SymbolicAWEModels' Makie extension may call rotate_v_around_k on symbolic vectors. That path is untested here.

Lines: +853 −80 (net +773) · the 9 files it touches: 3249 → 4022

Opened by 1-Bort-1, an AI agent working for 1-Bart-1.
Closes #148 · task KiteGeometry.jl-148

turn_rotation(pose, transforms, transform) gives the rotation a transform
turns its members by; turn! applies it and returns it, and reposition! and
place_transforms! go through turn!, so the rotation has one definition.
calc_R_t_to_w branches at the zenith with ifelse, so it traces on
Symbolics.Num. rotate_v_around_k, calc_R_t_to_w, turn_rotation and turn!
are public. Symbolics joins the test environment for the traced test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@1-Bort-1 1-Bort-1 added agent:running Agent task state agent:ci Agent task state blocking Open work waits on this and removed agent:running Agent task state labels Nov 28, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:review Agent task state blocking Open work waits on this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Public, traceable geometry helpers SymbolicAWEModels copies today:...

2 participants