Skip to content
Projects

Shape conventions

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

level_set

functionsource

Level-set values of the (ndim, n) points: negative inside, positive outside.

inversion
ϕSc(p)=−ϕS(p)\phi_{S^c}(p) = -\phi_S(p)
bound
ϕ<0 inside,ϕ=0 on ∂S,∣ϕ(p)∣≤dist⁡(p,∂S)\phi < 0 \text{ inside}, \quad \phi = 0 \text{ on } \partial S, \quad |\phi(p)| \le \operatorname{dist}(p, \partial S)
Assumes
  • an inverted shape is the complement of its geometry: contains_points is negated and the level set flips sign
  • equality in the bound where level_set_exact is true: the Euclidean signed distance
  • shapes known only by their membership test (has_level_set False) raise NotImplementedError

outlines

functionsource

Return the boundary loops of the shape as (2, n) host arrays.

orientation
A=12∑i(xiyi+1−xi+1yi)>0(counter-clockwise; otherwise reversed)A = \tfrac12 \sum_i (x_i y_{i+1} - x_{i+1} y_i) > 0 \quad \text{(counter-clockwise; otherwise reversed)}
pieces
n=⌈ℓsmax⁡ (1−10−12)⌉n = \left\lceil \frac{\ell}{s_{\max}}\,(1 - 10^{-12}) \right\rceil
graded
∫0ℓdls(l) in equal steps, trapezoidal on 256 intervals\int_0^{\ell} \frac{dl}{s(l)} \text{ in equal steps, trapezoidal on 256 intervals}
Order
2
Assumes
  • loops are (2,n)(2, n) without a repeated vertex; each edge of length ℓ\ell is split into nn equal pieces
  • curved shapes place every vertex on the curve; a circle gets 100 vertices without max_spacing
  • the order is that of the area enclosed by the outline of a circle in smax⁡s_{\max}