Compute signed area enclosed inside a NURBS curve

135 Views Asked by At

I need to compute the signed area enclosed inside a closed 2D - planar NURBS curve $\gamma(t)$. One way to accomplish this task is to use the Green Theorem. By appropriately choosing the functions of the statement of the theorem, as a consequence we obtain that we can compute the area as the following integral over the closed NURBS curve: $$A=\oint_{\gamma}xdy $$ To solve this integral I decompose the nurbs curve into its Bezier segments. A 2D (rational) Bezier segment is a curve of type: $$C(t)=(C_x(t),C_y(t))=\frac{\sum_{j=0}^{n} w_jP_jB_j^n(t)}{\sum_{j=0}^{n} w_jB_j^n(t)} $$ where $P_j = (p_j, q_j)$ is the j-th control point of the Bezier segment and $B_j^n$ is in the j-th Bernstein polynomial of degree n: $$B_j^n=\binom{n}{j}t^j(1-t)^{n-j}$$ I sum the integrals along the individual Bezier segments and I get the total area. On the single Bezier's segment the area is given by: $$ A_C=\int_a^bC_x(t){C'_y(t)}dt=\int_a^b\frac{\sum_{j=0}^{n} w_jp_jB_j^n(t)}{\sum_{j=0}^{n} w_jB_j^n(t)}*\frac{\mathrm{d} }{\mathrm{d} t}{\frac{\sum_{j=0}^{n} w_jq_jB_j^n(t)}{\sum_{j=0}^{n} w_jB_j^n(t)}}dt$$ It is an integral of a rational polynomial. Any advise on how to compute it?

How I started solving the problem: Computing the derivative of the quotient between two fraction and other basic properties I arrived at this difference between integrals: $$\int_a^b\frac{\sum_{j=0}^n\sum_{k=0}^n w_jw_kp_jq_kB_j^n(t)\frac{\mathrm{d} }{\mathrm{d} t}B_k^n(t)}{{(\sum_{j=0}^n w_jB_j^n(t))}^{2}}dt-\int_a^b\frac{\sum_{j=0}^n\sum_{k=0}^n\sum_{l=0}^n w_jw_kw_lp_jq_kB_j^n(t)B_k^n(t)\frac{\mathrm{d} }{\mathrm{d} t}B_l^n(t)}{{(\sum_{j=0}^n w_jB_j^n(t))}^{3}}dt$$ The first integral is a quotient between a polynomial of degree $2n-1$ ad a polynomial of degree $2n$ and looks a lot like something like $$\int\frac{\frac{\mathrm{d} }{\mathrm{d} t}f(t)}{f(t)}dt$$ because: $$\frac{\mathrm{d} }{\mathrm{d} t}{(\sum w_jB_j^n(t)))^2}=2\sum w_jB_j^n(t)\sum w_j\frac{\mathrm{d} }{\mathrm{d} t}{B_j^n(t)}=2\sum_j\sum_k w_jw_kB_j^n(t)\frac{\mathrm{d} }{\mathrm{d} t}B_k^n(t)$$ but I don't know how to bring it back to a known integral. It should probably be used a partial fraction but I can't understand which tecnique can be the best.