Skip to content
Projects

Swept absorption

The equations of simgeometry.polygon_objects, declared on the code that implements them and checked by the tests.

absorb

functionsource

Absorb the alive markers that end in, or step through, an object.

sweep
sweep  ⟺  ∣x1−x0∣2≤ℓsweep2,ℓsweep>0\text{sweep} \iff |x_1 - x_0|^2 \le \ell_\mathrm{sweep}^2, \qquad \ell_\mathrm{sweep} > 0
first object
k∗=arg min⁡kτk,τk<2;alive←false if k∗ existsk^* = \operatorname*{arg\,min}_k \tau_k, \quad \tau_k < 2; \qquad \text{alive} \leftarrow \text{false if } k^* \text{ exists}
Assumes
  • objects in slot order; an object kk with boxed[k] is skipped when the axis-aligned box of the step misses its bounds (an inverted object is solid outside its box and never skipped)
  • τk\tau_k from object_hit_times: a crossing in (0,1](0, 1], 0 for an end inside, 2 for no hit; strictly smaller wins, so the lower slot wins a tie, and an end inside beats every crossing
  • without a start, or for a step longer than sweep_length (wrapped or reinjected), only the end counts
  • packed: Polygon and the two plates of Aperture2D; other objects are left out
  • returns the object only, not the hit point, edge or normal (those come from crossings); cost O(edges) per marker and unboxed object
Built from