Debian Codegraph @

texmf-dist/doc/latex/sphdthesis/example/algorithm.tex

raw
1 \begin{SgAlgorithm}[t]
2 \SetKwInOut{Input}{Input}
3 \SetKwInOut{Output}{Output}
4 \SetKwFunction{GenerateAlphaVeins}{GenerateAlphaVeins}
5 \SetKwFunction{GenerateUniLeaf}{GenerateUnilobedLeaf}
6 \SetKwFunction{IntersectLobes}{IntersectLobes}
7 \SetKwFunction{FitBSpline}{FitBSpline}
8 \SetKwFunction{GenerateLaminarMargin}{GenerateLaminarMargin}
9 \SetKwFunction{Index}{Index}
10 \BlankLine
11 \Input{Parameters of the leaf model.}
12 \Output{Laminar shape $M$ as a triangle mesh.}
13 \BlankLine
14 $\{\alpha_i\} \leftarrow \GenerateAlphaVeins(s_0^l, s_0^r, \Delta s)$ \;
15 $L\leftarrow \GenerateUniLeaf(\theta(B^l), \theta(B^r), \theta(A^l), \theta(A^r), \vect{W}^l, \vect{W}^r)$ \;
16 \BlankLine
17 \ForEach{$\alpha$-vein $\alpha_i$}
18 {%
19 $L_i \leftarrow L$ \;
20 $L_i \leftarrow T_i\cdot L_i$ \;
21 }
22 \BlankLine
23 \For{$i=1$ \KwTo $n-1$}
24 {%
25 $\vect{p}^I(v_i) \leftarrow$ \IntersectLobes{$L_i$, $L_{i+1}$} \;
26 $\vect{d}(v_i) \leftarrow \dfrac{\vect{d}(\alpha_i) + \vect{d}(\alpha_{i+1})}{2}$ \;
27 \If{$p(v)$ or $\theta(v)$ is specified}
28 {%
29 $\vect{p}(v_i) \leftarrow \vect{p}^I(v_i) + p(v) l(\alpha_i) \vect{d}(v_i)$ \;
30 }
31 }
32 \BlankLine
33 \For{$i=1$ \KwTo $n-1$}
34 {%
35 \eIf{$p(v)$ or $\theta(v)$ is not specified}
36 {%
37 $M \leftarrow M \cup \left\{\vect{p}_j \mid j \in L_i \wedge \Index(\vect{q}(\alpha_i), L_i) \leq j \leq \Index(\vect{p}^I(v_i), L_i) \right\}$ \;
38 $M \leftarrow M \cup \left\{\vect{p}_j \mid j \in L_{i+1} \wedge \Index(\vect{p}^I(v_i), L_{i+1}) < j \leq \Index(\vect{q}(\alpha_{i+1}), L_{i+1})\right\}$ \;
39 }
40 {%
41 $b_1 \leftarrow \FitBSpline(\vect{q}(\alpha_i), \theta(\vect{q}(\alpha_i)), \vect{W}^l(\alpha_i), \vect{r}(v_i), \theta(v_i))$ \;
42 $b_2 \leftarrow \FitBSpline(\vect{r}(v_i), \theta(v_i), \vect{W}^r(\alpha_{i+1}), \vect{q}(\alpha_{i+1}), \theta(\vect{q}(\alpha_{i+1})))$ \;
43 Discretize $b_1$ and append the points to $M$ \;
44 Discretize $b_2$ and append the points to $M$ \;
45 }
46 }
47 \caption[Laminar shape generation algorithm for multilobed leaves]{Laminar shape generation algorithm for multilobed leaves.}
48 \label{algo:Ch6-ShapeGen}
49 \end{SgAlgorithm}