fix(flippers): match original moving-hit geometry

The clone's moving-flipper gate used the cross-product operands in the
opposite order, mirroring and narrowing the hit wedge. Right-flipper release
also used record 81's first endpoint even though the original reads its second
endpoint. Correct both geometry paths, retain the recovered swept tip bounds,
and add live-binary boundary vectors plus a dense transition regression.

Test Plan:
- `cargo test --workspace --all-targets --all-features` -- passed (134 tests)
- `cargo clippy --workspace --all-targets --all-features -- -D warnings` -- passed
- `cargo build --profile production` -- passed
- `LSAN_OPTIONS=detect_leaks=0 ASAN_OPTIONS=detect_leaks=0 bash original/tools/test_reconstructed_c.sh` -- passed
- `python3 original/tools/audit_reconstruction.py --require-complete` -- passed
- `git diff --cached --check` -- passed
This commit is contained in:
2026-08-29 09:15:25 +02:00
parent faf66f1ac0
commit fa3f168467
5 changed files with 517 additions and 55 deletions
@@ -158,10 +158,10 @@ static FlipperCollisionGeometry load_flipper_geometry(
geometry.unused_positive_point_x = record_i32(
81, offsetof(TdkpinCollisionRecord, point1_x_milli));
geometry.positive_edge_x = subtract_wrap_i32(
record_i32(81, offsetof(TdkpinCollisionRecord, point1_x_milli)),
record_i32(81, offsetof(TdkpinCollisionRecord, point2_x_milli)),
20000);
geometry.positive_edge_y = record_i32(
81, offsetof(TdkpinCollisionRecord, point1_y_milli));
81, offsetof(TdkpinCollisionRecord, point2_y_milli));
geometry.response_record = delta == 1 ? 81 : 83;
} else {
geometry = (FlipperCollisionGeometry){
@@ -202,8 +202,8 @@ static int32_t cross_product_for_edge(
int32_t edge_from_pivot_x = divide_by_thousand(
subtract_wrap_i32(edge_x, pivot_x));
return subtract_wrap_i32(
borland_multiply_i32(edge_from_ball_y, edge_from_pivot_x),
borland_multiply_i32(edge_from_ball_x, edge_from_pivot_y));
borland_multiply_i32(edge_from_ball_x, edge_from_pivot_y),
borland_multiply_i32(edge_from_ball_y, edge_from_pivot_x));
}
static int32_t radial_distance_milli(