A capsule sweep meets a quad's two triangles at its first touch near their shared diagonal #28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/3982-a-capsule-sweep-misses-or-meets-late-a-q"
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?
Tracker: #3982
sweepTriangle(src/physics/collision.sx) steps a capsule toward a triangle at the rate its distance closes. When the triangle's closest point lay on an inner edge or at an inner corner, the step took that rate along the face normal, which is whatapartgives there. The gap between the closest points leans off that normal toward the coplanar neighbour, so a step could overshoot the first touch, or read a capsule as moving away and miss the quad entirely.This PR delivers:
Tests
tests/sweep_first_touch.sx:tests/physics_queries.sx: the reviewed case as a literal. A capsule rests 0.9 TOUCH off a level quad and slides level across its diagonal. It meets nothing.tests/first_map_moves.sx:tools/sx run.Before and after
src/physics/collision.sxandtests/support/worlds.sxare unchanged from5af4834to master429d5d7.The task's probe (
sweep_diag_probe.sx):429d5d7tests/sweep_first_touch.sx:5af4834it fails: the level quad has 31 missed and 150 late of 1682, the turned quad 31 and 144 of 1670, and the four squares 88 and 494 of 1682. Master also meets 3, 4 and 3 of the 9000 slides, all sinking ones.3dfeefa, where the seam's leave rule held only where a landing itself read a seam, the slides meet the surface 531, 475 and 1438 times of 9000.tests/physics_queries.sx's new literal meets triangle 1 at fraction 0.245 at3dfeefa. It meets nothing at master and at this PR's head.tests/first_map_moves.sx:A broader scratch probe over seven worlds: a 6 × 6 tessellated floor, a 20° incline, a quad turned 0.7 rad, a strip of level tiles at (140–160, 16, −14 to −6), a block, an octagonal frustum, and the same frustum at (250, 3, −270).
3dfeefahas no miss or late hit, but its slides meet the flat surfaces: 184 on the tessellated floor, 14 on the incline, 15 on the turned quad and 52 on the far tiles.Movement changes only where a sweep met an inner edge
sweepTrianglediffers from master only once some step's closest point lies on an inner edge or corner, so movement can change only there. Two scratch arms check this:sweepTriangleruns master's rule and this PR's, returns this PR's result, and prints each call whose two results differ, with whether the call met a seam.check/near/nearVec/withinprints its figures.Every test ran in these arms. The results:
3dfeefait was 0.839451: a step from a seam there landed on a face and met it while the motion ran along it, and this PR passes that landing.Mutants
Each mutant ran physics_queries, sweep_first_touch, sim_move, sim_trunks and first_map_moves, and each of these fails one:
3dfeefa)The last two fail only first_map_moves: each changes the path of a first-map walk, which then ends a tick 0.12–0.44 mm inside.
Carrying the seam's rule to every later landing of the sweep, not only to the landing of a step from a seam, fails no test and moves no checked figure. It differs from this PR in 129 sweeps of the tests: sim_trunks 114, first_map_moves 13, solids 2. In each, a later step lands on an outer edge or corner while the motion runs along or away from it. The outer part's own rule holds there, as at master, so this PR carries the seam's rule one step only.
Gates
fastat76ab354: gate run 997, passed, 45 of 45 tests.fullat3dfeefa: gate run 998, passed, 46 of 46 tests.fullat66f317e: gate run 1, passed, 46 of 46 tests. The physics bench's worst tick was 0.49 ms, within its 2 ms budget.