Skip to content
Projects

Rectangle

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

Rectangle

classsource

Represent a rectangular geometry object.

inside
p∈S  ⟺  l≤p<u(f=0),p∈S  ⟺  ϕ(p)≤0(f>0)p \in S \iff l \le p < u \quad (f = 0), \qquad p \in S \iff \phi(p) \le 0 \quad (f > 0)
level set
ϕ(p)=∣max⁡(d,0)∣+min⁡(max⁡kdk,0)−f,d=∣p−c∣−(h−f)\phi(p) = \big|\max(d, 0)\big| + \min\big(\max_k d_k, 0\big) - f, \qquad d = |p - c| - (h - f)
Assumes
  • axis-aligned, centre cc, half sides hh; ∣⋅∣|\cdot| and max⁡(⋅,0)\max(\cdot, 0) of dd componentwise
  • the fillet f≤min⁡khkf \le \min_k h_k rounds the corners: the box shrunk by ff, widened by a disc of radius ff
  • without a fillet the inside test is the half-open box of BoundingBox.contains
  • ϕ\phi is the exact signed distance, negative inside
References