Closed carlos-adir closed 7 months ago
An adaptative algorithm was used to compute the polynomial integrals of non-polygonal curves. It doesn't make the divisions and compute polygonal integrals, but instead, we use Milne's method.
It's better described and implemented in integral.py
Method
Inspired by the adaptative quadrature, a good idea to discretize a curved domain is by adaptative subdivision:
For now, let $a$ and $b$ be two positive integer values. We define the metric by
$$I{a, b} = \int{\Omega} x^a \ y^b \ dx \ dy$$
As described in the theory, this integral is converted into a boundary integral.
$$I{a, b} = \int{\Gamma} \square \ ds$$
Sice the boundary curves are described by
nurbs
, aknotvector
is known andknots
are used for initial division$$I{a, b} = \sum{k=0}^{n-1} I_k; \ \ \ \ \ \ \ \ \ \ \ \ \ Ik = \int{tk}^{t{k+1}} \square \ dt$$
The criterea is to use adaptive quadrature to compute $\overline{I}_k$ such
$$\left[\overline{I}{a,b,k} - I{a,b,k}\right] < \dfrac{\varepsilon}{n}$$
Polygonal domains
As described in the theory, the value of $I_{a, b}$ for a polygonal domain can be computed exactly as
$$(a+b+2)(a+b+1)\binom{a+b}{a} I{a,b} = \sum{k=0}^{n-1} J_k$$
$$Jk = \left(x{k}y{k+1}-y{k}x{k+1}\right) \sum{i=0, \ j=0}^{a, \ b} \binom{i+j}{j} \binom{a+b-i-j}{b-j} x{k}^{a-i}x{k+1}^{i}y{k}^{b-j}y{k+1}^{j}$$
But as $xk$, $y{k}$, $x{k+1}$, $y{k+1}$ are obtained from the evaluations of the curve at points $tk$ and $t{k+1}$, then a new approximation can be obtained by evaluating at middle point
Algorithm
The main idea is:
knots
from theknotvector
of the curve(tk0, tk1)
: