Skip to content
Projects

Edge crossings

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

intersection_fractions

functionsource

Locate bracketed outside-to-inside edge crossings; return raw, unclamped fractions.

secant
t=tafb−tbfafb−fa,f(t)=ϕ(a+t d)t = \frac{t_a f_b - t_b f_a}{f_b - f_a}, \qquad f(t) = \phi(a + t\,d)
illinois
(ta,fa)←(t,f) if sign⁡f=sign⁡fa, else (tb,fb)←(t,f);fb←fb/2  (fa←fa/2) if b  (a) is kept twice in a row(t_a, f_a) \leftarrow (t, f) \text{ if } \operatorname{sign} f = \operatorname{sign} f_a, \text{ else } (t_b, f_b) \leftarrow (t, f); \quad f_b \leftarrow f_b/2 \;(f_a \leftarrow f_a/2) \text{ if } b \;(a) \text{ is kept twice in a row}
converged
∣f∣≤ν=ε (max⁡k∣ak∣+max⁡k∣dk∣)  or  ∣t′−t∣≤τ  or  ∣tb−ta∣≤τ,τ=2−m|f| \le \nu = \varepsilon\,\big(\max_k|a_k| + \max_k|d_k|\big) \;\text{or}\; |t' - t| \le \tau \;\text{or}\; |t_b - t_a| \le \tau, \qquad \tau = 2^{-m}
bisection
min⁡ ⁣(m,max⁡(1,⌈log⁡2(w 2m)⌉)) halvings on membership,t=thi\min\!\Big(m, \max\big(1, \big\lceil \log_2(w\,2^{m}) \big\rceil\big)\Big) \text{ halvings on membership}, \qquad t = t_\mathrm{hi}
Order
1
Assumes
  • each edge from an outside point aa to an inside point a+da + d brackets one crossing (ValueError otherwise); the fraction is measured from the outside end and not clamped
  • with a level set and ϕ(a)>0>ϕ(a+d)\phi(a) > 0 > \phi(a + d): at most 12 Illinois steps (SECANT_STEPS), superlinear (order about 1.44 for a simple root)
  • the other edges, and those Illinois left unsettled with their narrowed bracket of width ww, are bisected on membership and return the inside end thit_\mathrm{hi}
  • wrap maps periodic images into the domain before every membership or level-set call
  • the order is that of the bisection in the final bracket width 2−m2^{-m} (iterations m=48m = 48)
References