Fix register_positions_projected! not updating when float32convert changes#5485
Fix register_positions_projected! not updating when float32convert changes#5485asinghvi17 wants to merge 11 commits intomasterfrom
register_positions_projected! not updating when float32convert changes#5485Conversation
register_positions_projected! not updating when float32convert changes
0130e4c to
004d895
Compare
|
This should not happen in We should also not do the inverse float32convert and transform_func solely based on |
Benchmark ResultsSHA: 8d84cce5252acbcefd1a3a89c83fd6eedf0d49a2 Warning These results are subject to substantial noise because GitHub's CI runs on shared machines that are not ideally suited for benchmarking. |
|
That sounds reasonable but then we should probably point users to the function you just mentioned rather than here?
I know it's a broken record at this point but |
004d895 to
ae53d14
Compare
…anges When projecting from a non-data space (e.g. :relative, :pixel) to a data space, the camera matrices give f32c-scaled coordinates because the camera projection is set up in f32c space. To get actual data coordinates, we need to apply the inverse of float32convert to the output positions. This fix: - Detects when we're projecting from non-data space to data space - Adds :f32c as a dependency so output updates when float32convert changes - Applies inv(f32c) to convert f32c-scaled coordinates to data coordinates Note: This does not yet handle transform_func for these projections. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
ae53d14 to
55aec6b
Compare
Where are we doing that? Both the bits I added to the online docs don't:
And my broken record answer is that transformations can apply to any space and we'd need a bunch of variants of I wanted to avoid that by just keeping transformations and projections separate. This is still changing code in I think this pr should just do inverse model and inverse transform function too. And keep the style of the forward transformations. I.e. have I think it's fine to just assume the inverse transform function exists when We should probably also have earlier exit conditions to avoid stuff like |
|
Hm it's possible I looked at some recipe implementation or so and got this from there, or had an earlier concept that I took some code from. I see your point about the combinatorial explosion you get since we now allow Will get claude to add the other two options as well. |
…itions! - Add apply_inverse_transform, apply_inverse_transform_func, apply_inverse_float32convert, and apply_inverse_model kwargs - These enable correct projection from non-data spaces back to data space - Add early-exit optimization to skip redundant transform/inverse pairs when input_space === output_space - Add apply_inverse_model_to_positions helper function - Update docstring with new kwargs - Add tests for inverse transform_func 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
078fa2e to
2652255
Compare
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Bumping on this, it should have everything requested now (I think) |
| apply_model::Bool = apply_transform, | ||
| apply_clip_planes::Bool = false, | ||
| # Inverse transforms | ||
| apply_inverse_transform::Bool = output_space === :space, |
There was a problem hiding this comment.
I'm still unsure what to do with the default for apply_inverse_transform. To make this a completely non-breaking change (with my changes) it would need to be false and apply_inverse_float32convert = is_data_space(output_space).
With that output_space = :space would trigger a forward transform_func and a forward model application without a float32convert, rather than skipping everything. I think the old version is more useful here, though technically also a bit risky/wrong since projections use Float32 matrices and don't know whether float32converts have been applied or not, i.e. they might pick the wrong model matrix.
Summary
register_positions_projected!not updating output positions whenfloat32convertchanges:relative,:pixel) to data space, applies inverse f32c to get actual data coordinates:f32cas a dependency so outputs update when float32convert changesProblem
When using
register_positions_projected!withinput_space = :relativeandoutput_space = :space, the output positions were incorrect afterfloat32convertchanged (e.g., after callinglimits!to zoom into a small region).The root cause is that camera matrices operate in f32c-scaled space (the projection is set based on
f32_convert(scene.float32convert, limits)). When transforming from a non-data space to data space, the output needs the inverse of float32convert applied, but this wasn't happening.Limitation
This fix does not yet account for
transform_funcwhen projecting from non-data space to data space.Test plan
🤖 Generated with Claude Code