initial
65
dokumentation/B-Spline-Volumes.md
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
# B-Spline Volumes
|
||||||
|
|
||||||
|
B-Spline Volumes are a simple extension of B-Splines to 3 Dimensions. This is
|
||||||
|
a straightforward adaption of the 2-Dimensional version.
|
||||||
|
|
||||||
|
## Nomenclature
|
||||||
|
|
||||||
|
$x,y,z$ denote space-coordinates,
|
||||||
|
$u,v,w$ denote spline-coordinates (Between 0-1),
|
||||||
|
$P_{ijk}$ denote the control-Points on the control-Polygon,
|
||||||
|
$N_{i,d,\tau}(u)$ denote the value of the underlying Basis-Functions at value
|
||||||
|
$u$ using the $i$-th Basis-Function of degree $d$ in range $\tau$.
|
||||||
|
|
||||||
|
For our case we only care about degree-3 splines, so we omit the d furtheron.
|
||||||
|
$\tau$ is defined statically (in each direction) with each $P$ as Position on the whole surface/volume and within [0,1].
|
||||||
|
For a regular Control-Grid this defaults to $\tau_i = i/n$
|
||||||
|
|
||||||
|
Given $n,m,o$ control points in $x,y,z$-direction each Point on the curve is
|
||||||
|
defined by
|
||||||
|
|
||||||
|
$$C(u,v,w) = \sum_{i=0}^{n-d-2} \sum_{j=0}^{m-d-2} \sum_{k=0}^{o-d-2} P_{ijk} N_{i}(u) N_j(v) N_k(w)$$
|
||||||
|
|
||||||
|
## Calculate $u, v, w$
|
||||||
|
|
||||||
|
Given a target-point $\textbf{p}^*$ and an initial guess $\textbf{p}=C(u,v,w)$ we
|
||||||
|
define the error-function as:
|
||||||
|
|
||||||
|
$$Err(u,v,w,\textbf{p}^{*}) = \| \textbf{p}^{*} - C(u,v,w) \|_2^2$$
|
||||||
|
|
||||||
|
As the error is just the sum of the components
|
||||||
|
|
||||||
|
$$Err(u,v,w,\textbf{p}^{*}) = Err_x(u,v,w,\textbf{p}^{*}) + Err_y(u,v,w,\textbf{p}^{*}) + Err_z(u,v,w,\textbf{p}^{*})$$
|
||||||
|
|
||||||
|
we just take one axis into account, as the others are nearly identical. So we yield
|
||||||
|
|
||||||
|
$$Err_x(u,v,w,\textbf{p}^{*}) = \left( p^{*}_x - \sum_{i=0}^{n-d-2} \sum_{j=0}^{m-d-2} \sum_{k=0}^{o-d-2} {P_{ijk}}_x N_{i}(u) N_j(v) N_k(w) \right)^2 $$
|
||||||
|
|
||||||
|
To solve this we derive:
|
||||||
|
|
||||||
|
$$
|
||||||
|
\begin{array}{rl}
|
||||||
|
\displaystyle \frac{\partial}{\partial u} & \left( p^{*}_x - \displaystyle \sum_{i=0}^{n-d-2} \sum_{j=0}^{m-d-2} \sum_{k=0}^{o-d-2} {P_{ijk}}_x N_{i}(u) N_j(v) N_k(w) \right)^2 \\
|
||||||
|
= & \displaystyle - \sum_{i=0}^{n-d-2} \sum_{j=0}^{m-d-2} \sum_{k=0}^{o-d-2} {P_{ijk}}_x N'_{i}(u) N_j(v) N_k(w) \\
|
||||||
|
& \cdot \left( p^{*}_x - \displaystyle \sum_{i=0}^{n-d-2} \sum_{j=0}^{m-d-2} \sum_{k=0}^{o-d-2} {P_{ijk}}_x N_{i}(u) N_j(v) N_k(w) \right) \\
|
||||||
|
& \cdot 2
|
||||||
|
\end{array}
|
||||||
|
$$
|
||||||
|
|
||||||
|
The other partial derivatives follow the same pattern.
|
||||||
|
|
||||||
|
## Basis-Splines and Derivatives
|
||||||
|
|
||||||
|
The previously mentioned $N_{i,d,\tau}$ are defined recursively:
|
||||||
|
|
||||||
|
$$N_{i,0,\tau}(u) = \begin{cases} 1, & u \in [\tau_i, \tau_{i+1}[ \\ 0, & \mbox{otherwise} \end{cases} $$
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
$$N_{i,d,\tau}(u) = \frac{u-\tau_i}{\tau_{i+d}} N_{i,d-1,\tau}(u) + \frac{\tau_{i+d+1} - u}{\tau_{i+d+1}-\tau_{i+1}} N_{i+1,d-1,\tau}(u) $$
|
||||||
|
|
||||||
|
This fact can be exploited to get the derivative for an arbitrary $N$:
|
||||||
|
|
||||||
|
$$\frac{d}{du} N_{i,d,r}(u) = \frac{d}{\tau_{i+d} - \tau_i} N_{i,d-1,\tau}(u) - \frac{d}{\tau_{i+d+1} - \tau_{i+1}} N_{i+1,d-1,\tau}(u)$$
|
||||||
|
|
||||||
|
*Warning:* in the case of $d=1$ the recursion-formula yields a $0$ denominator, but $N$ is also $0$. The right solution for this case is a derivative of $0$
|
BIN
dokumentation/B-Spline-Volumes.pdf
Normal file
75
dokumentation/B-Spline-Volumes2.md
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
# B-Spline Volumes
|
||||||
|
|
||||||
|
B-Spline Volumes are a simple extension of B-Splines to 3 Dimensions. This is
|
||||||
|
a straightforward adaption of the 2-Dimensional version.
|
||||||
|
|
||||||
|
## Nomenclature
|
||||||
|
|
||||||
|
$x,y,z$ denote space-coordinates,
|
||||||
|
$u,v,w$ denote spline-coordinates (Between 0-1),
|
||||||
|
$P_{ijk}$ denote the control-Points on the control-Polygon,
|
||||||
|
$N_{i,d,\tau}(u)$ denote the value of the underlying Basis-Functions at value
|
||||||
|
$u$ using the $i$-th Basis-Function of degree $d$ in range $\tau$.
|
||||||
|
|
||||||
|
For our case we only care about degree-3 splines, so we omit the d furtheron.
|
||||||
|
$\tau$ is defined statically (in each direction) with each $P$ as Position on the whole surface/volume and within [0,1].
|
||||||
|
For a regular Control-Grid this defaults to $\tau_i = i/n$
|
||||||
|
|
||||||
|
Given $n,m,o$ control points in $x,y,z$-direction each Point on the curve is
|
||||||
|
defined by
|
||||||
|
|
||||||
|
$$C(u,v,w) = \sum_{i=0}^{n-d-2} \sum_{j=0}^{m-d-2} \sum_{k=0}^{o-d-2} P_{ijk} N_{i}(u) N_j(v) N_k(w)$$
|
||||||
|
|
||||||
|
## Calculate $u, v, w$
|
||||||
|
|
||||||
|
Given a target-point $\textbf{p}^*$ and an initial guess $\textbf{p}=C(u,v,w)$ we
|
||||||
|
define the error-function as:
|
||||||
|
|
||||||
|
$$Err(u,v,w,\textbf{p}^{*}) = \textbf{p}^{*} - C(u,v,w)$$
|
||||||
|
|
||||||
|
|
||||||
|
$$Err_x(u,v,w,\textbf{p}^{*}) = p^{*}_x - \sum_{i=0}^{n-d-2} \sum_{j=0}^{m-d-2} \sum_{k=0}^{o-d-2} {P_{ijk}}_x N_{i}(u) N_j(v) N_k(w) $$
|
||||||
|
|
||||||
|
To solve this we derive:
|
||||||
|
|
||||||
|
$$
|
||||||
|
\begin{array}{rl}
|
||||||
|
\displaystyle \frac{\partial Err_x}{\partial u} & p^{*}_x - \displaystyle \sum_{i=0}^{n-d-2} \sum_{j=0}^{m-d-2} \sum_{k=0}^{o-d-2} {P_{ijk}}_x N_{i}(u) N_j(v) N_k(w) \\
|
||||||
|
= & \displaystyle - \sum_{i=0}^{n-d-2} \sum_{j=0}^{m-d-2} \sum_{k=0}^{o-d-2} {P_{ijk}}_x N'_{i}(u) N_j(v) N_k(w)
|
||||||
|
\end{array}
|
||||||
|
$$
|
||||||
|
|
||||||
|
The other partial derivatives follow the same pattern yiedling the Jacobian:
|
||||||
|
|
||||||
|
$$
|
||||||
|
J(Err(u,v,w)) =
|
||||||
|
\left(
|
||||||
|
\begin{array}{ccc}
|
||||||
|
\frac{\partial Err_x}{\partial u} & \frac{\partial Err_x}{\partial v} & \frac{\partial Err_x}{\partial w} \\
|
||||||
|
\frac{\partial Err_y}{\partial u} & \frac{\partial Err_y}{\partial v} & \frac{\partial Err_y}{\partial w} \\
|
||||||
|
\frac{\partial Err_z}{\partial u} & \frac{\partial Err_z}{\partial v} & \frac{\partial Err_z}{\partial w}
|
||||||
|
\end{array}
|
||||||
|
\right)
|
||||||
|
$$
|
||||||
|
|
||||||
|
Iterate with
|
||||||
|
|
||||||
|
$$J(Err(u,v,w)) \cdot \Delta \left( \begin{array}{c} u \\ v \\ w \end{array} \right) = -Err(u,v,w)$$
|
||||||
|
|
||||||
|
using Cramers rule for solving the SLE.
|
||||||
|
|
||||||
|
## Basis-Splines and Derivatives
|
||||||
|
|
||||||
|
The previously mentioned $N_{i,d,\tau}$ are defined recursively:
|
||||||
|
|
||||||
|
$$N_{i,0,\tau}(u) = \begin{cases} 1, & u \in [\tau_i, \tau_{i+1}[ \\ 0, & \mbox{otherwise} \end{cases} $$
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
$$N_{i,d,\tau}(u) = \frac{u-\tau_i}{\tau_{i+d}} N_{i,d-1,\tau}(u) + \frac{\tau_{i+d+1} - u}{\tau_{i+d+1}-\tau_{i+1}} N_{i+1,d-1,\tau}(u) $$
|
||||||
|
|
||||||
|
This fact can be exploited to get the derivative for an arbitrary $N$:
|
||||||
|
|
||||||
|
$$\frac{d}{du} N_{i,d,r}(u) = \frac{d}{\tau_{i+d} - \tau_i} N_{i,d-1,\tau}(u) - \frac{d}{\tau_{i+d+1} - \tau_{i+1}} N_{i+1,d-1,\tau}(u)$$
|
||||||
|
|
||||||
|
*Warning:* in the case of $d=1$ the recursion-formula yields a $0$ denominator, but $N$ is also $0$. The right solution for this case is a derivative of $0$
|
BIN
dokumentation/B-Spline-Volumes2.pdf
Normal file
BIN
dokumentation/firstFit.png
Normal file
After Width: | Height: | Size: 4.7 MiB |
BIN
dokumentation/firstFit_50x50.png
Normal file
After Width: | Height: | Size: 4.7 MiB |
BIN
dokumentation/firstFit_50x50_wire_below.png
Normal file
After Width: | Height: | Size: 4.7 MiB |
BIN
dokumentation/firstFit_50x50_wire_closeup.png
Normal file
After Width: | Height: | Size: 4.7 MiB |
BIN
dokumentation/firstFit_50x50_wire_closeup2.png
Normal file
After Width: | Height: | Size: 4.7 MiB |
BIN
dokumentation/firstFit_50x50_wire_top.png
Normal file
After Width: | Height: | Size: 4.7 MiB |
BIN
dokumentation/perturbation/2step-50iteration.png
Normal file
After Width: | Height: | Size: 4.7 MiB |
BIN
dokumentation/perturbation/step0.png
Normal file
After Width: | Height: | Size: 4.7 MiB |
BIN
dokumentation/perturbation/step1.png
Normal file
After Width: | Height: | Size: 4.7 MiB |
BIN
dokumentation/perturbation/step5.png
Normal file
After Width: | Height: | Size: 4.7 MiB |
BIN
references/Partial derivatives of Bezier surfaces.pdf
Normal file
BIN
screenshots/20170322_plane-deformation.png
Normal file
After Width: | Height: | Size: 4.7 MiB |