Flapping Bird

part two

Double Reverse Fold

cur = RU[[2]][[1]][[3]];
cdr = RD[[2]][[1]][[3]];
nu = boo[[1]][[1]][[1]];
BeakStages = {};
Do[boo = Chop[reverseFold[m0, m1, m2, m3, m4, N[fee]]];
   t = boo[[2, 1, 3]];
   t1 = reflection3[t, Polygon[{m0, m2, m3}]];
   s = boo[[1]][[1]][[2]];
   s1 = reflection3[t, Polygon[{m0, m2, m3}]];
   FFboo = First[First[boo]];
   k0 = .35 FFboo[[1]] + .65 FFboo[[3]];
   k1star = .35 FFboo[[2]] + .65 FFboo[[3]];
   aoo = reverseFoldAuxTwo[boo[[1]], m4, k0, k1star];
   hoo = Append[aoo, boo[[2]]];
   (* Last five lines generate the small beak *)
   PO1 = {Polygon[{cur, t1, s1, nu}], Polygon[{cdr, t, s, nu}]};
   joo = Join[NS, PO1, hoo,
            Map[reflection3[#, Polygon[{m0, m2, m3}]]&, hoo]];
   BeakStages = Append[BeakStages, 
        Graphics3D[Prepend[joo, EdgeForm[
                   RGBColor[.1, .0, .9]]],
                   Boxed -> False,         
                   PlotRange -> All,
                   ViewPoint -> {1, 0, 1}]],
           {fee, Pi/2, .001, -(Pi/24 - .01)}];

Map[Show, BeakStages];

Points for Opening Tail.

SN = Drop[joo, 12];
SNref = Map[Chop[reflection3[#,
                 Polygon[{SN[[1]][[1]][[1]],
                 SN[[1]][[1]][[4]],
                 SN[[2]][[1]][[1]]}]]]&, SN];

(* finding points for opening tail*)
ugol = N[(Pi/24 - 0.002) 24];
LU = basicBird[lu, N[-ugol]];
RU = basicBird[ru, N[ugol]];
LD = basicBird[ld, N[ugol]];
RD = basicBird[rd, N[-ugol]];
RU = basicBird[ru, N[ugol]];
M = First[RU];
l = Line[{First[M][[3]], First[M][[1]]}];
m4 = First[Last[c]][[3]];
m3 = First[First[RU]][[1]];
m2 = First[First[RU]][[3]];
m1 = m2 + .18 (m3 - m2);
m0 = First[Last[RU]][[3]];
Pol = {Polygon[{m4, m0, m3, m1, m2}]};
fig1 = Join[{EdgeForm[{RGBColor[.1, .0, .9],
           Thickness[.005]}]}, LU, RU, LD, RD, c];
cur = RU[[2]][[1]][[3]];
cdr = RD[[2]][[1]][[3]];

Opening Tail

ReverseStages1 = {};
Do[boo = Chop[reverseFoldAuxOne[m0, m1, m2, m3, m4, N[fee],
              False]];
   t = boo[[2,1,3]];
   t1 = reflection3[t, Polygon[{m0, m2, m3}]];
   joo = Join[SNref, {Polygon[{cur, t1, m3}],
                Polygon[{cdr, t, m3}],
                RGBColor[.1, .0, .9], 
                Thickness[.005],
                Line[{t1, (c6 + cu)/2 + {.0,.0,.0001}}],
                Line[{t, (c6 + cu)/2 - {.0,.0,0.1}}]},
                      boo, Map[reflection3[#,
                Polygon[{m0, m2, m3}]]&, boo]];
   
   ReverseStages1 = Append[ReverseStages1,
               Graphics3D[Prepend[joo, EdgeForm[
                          RGBColor[.1, .0, .9]]],
                          Boxed->False,        
                          PlotRange -> All,
                          ViewPoint->{1, 0, 1}]],
         {fee, .001, Pi/2 - .001, Pi/12 - .01}];

Map[Show, ReverseStages1];

Points of the Tail of the Bird

Tal=Take[joo,12];

(* finding points for function reverseFold[], here we need*)
(* only exchange in the operations  for determining   *)
(* points m0, m1, m2, m3, m4 R(right) -> L(left) *)
ugol = N[(Pi/24 - .002) 24];
LU = basicBird[lu, N[-ugol]];
RU = basicBird[ru, N[ugol]];
LD = basicBird[ld, N[ugol]];
RD = basicBird[rd, N[-ugol]];
RU = basicBird[ru, N[ugol]];
M = First[RU];
l  = Line[{First[M][[3]], First[M][[1]]}];
m4 = First[Last[c]][[3]];
m3 = First[First[LU]][[1]];
m2 = First[First[LU]][[3]];
m1 = m2 + .15 (m3 - m2);
m0 = First[Last[LU]][[3]];
Pol = {Polygon[{m4, m0, m3, m1, m2}]};

(*new moving part of bird*)
a = Take[Tal, 4];
b = Take[Tal, -4];
cm = Drop[Drop[Tal, 4], -3];
MP = Join[a, cm, b];

tochki = {RGBColor[.8, .0, .3], PointSize[.02],
          Point[m0], Point[m1], Point[m2], Point[m3],
          Point[m4]};
fig1 = Join[{EdgeForm[{RGBColor[.1, .0, .9],
             Thickness[.005]}]}, LU, LD, cm];

Opt1 = {LightSources ->   
       {{{0, 0, 1}, RGBColor[.31, .0, 1.]}, 
       {{0, 10, 0}, RGBColor[.71, .0, .99]}, 
       {{10, 0, 0}, RGBColor[ .51, .0, 1.]}}};
nu = boo[[1]][[1]][[1]];

Reverse the Tail

ReverseTail = {};
Do[
   boo = Chop[reverseFold[m0, m1, m2, m3, m4, N[fee]]];
   t= boo[[2,1,3]];
   t1 = reflection3[t, Polygon[{m0, m2, m3}]];
   s = boo[[1]][[1]][[2]];
   s1 = reflection3[t, Polygon[{m0, m2, m3}]];
   PO1 = {Polygon[{cdr, t1, s1, nu}], 
          Polygon[{cur, t, s, nu}]};
   joo = Join[SN, PO1, boo, 
           Map[reflection3[#, Polygon[{m0, m2, m3}]]&,
                     boo]];
   ReverseTail = Append[ReverseTail,
                Graphics3D[Prepend[joo, EdgeForm[
                RGBColor[.1, .0, .9]]],
                Boxed -> False, PlotRange -> All]],
   {fee, Pi/2 - .001, .001, -(Pi/24-.0001)}];

Map[Show, ReverseTail];

Initial settting for flapping

joo1 = Join[Drop[SN,2], boo, Map[reflection3[#,
                 Polygon[{m0, m2, m3}]]&, boo]];

golovar = Drop[Take[joo1, 5], {3,3}];
ghghr = Join[Drop[joo1,5],Take[joo1, {3,3}]];          
hvostr = Join[Take[ghghr, {2,2}], Take[ghghr, {4,4}]];
gor = Drop[Drop[ghghr, {2,2}], {3,3}];          
p0 = Last[gor][[1]][[4]];        
tulr = Join[golovar, hvostr];
h1r = First[hvostr][[1]][[2]];
h2r = Last[hvostr][[1]][[2]];
g2r = golovar[[2]][[1]][[3]];
g1r = golovar[[4]][[1]][[3]];
b = Last[golovar][[1]][[4]];
g0 = golovar[[1]][[1]][[1]];
h0 = hvostr[[1]][[1]][[3]];

c2r = Take[joo1, {3,3}][[1]][[1]][[3]];
c1r = Take[joo1, {6,6}][[1]][[1]][[3]];
a2r = Take[joo1, {10,10}][[1]][[1]][[3]];
a1r = Take[joo1, {8,8}][[1]][[1]][[3]];
b2 = Take[SN, {2,2}][[1]][[1]][[1]];
b1 = Take[SN, {1,1}][[1]][[1]][[1]];

gor1 = {Polygon[{h1r, a1r, b}], Polygon[{b, c1r, g1r}]};
gor2 = {Polygon[{h2r, a2r, b}], Polygon[{b, c2r, g2r}]};
KN1 = {Polygon[{a1r, c1r, b}]};
KN2 = {Polygon[{a2r, c2r, b}]};
bi1 = bisector[Polygon[{a1r, b1, c1r}]][[1]][[2]];
bi2 = bisector[Polygon[{a2r, b2, c2r}]][[1]][[2]];
KP1 = {Polygon[{a1r, b1, bi1}], Polygon[{bi2, b1, c1r}]};
KP2 = {Polygon[{a2r, b2, bi2}], Polygon[{bi2, b2, c2r}]};
Nbase = Join[golovar, hvostr, gor2, gor1, KN1, KN2];

mir = Polygon[{g0, p0, b}];
qoo1 = {{Join[Nbase, KN1], KP1,
           Map[reflection3[#, mir]&, KP1]}, c1r};

Unmoved part of the wings

tmp = qoo1;
WingBase = {};
Do[tmp = WingStep[tmp, N[Pi/20], mir];
WingBase = Append[WingBase, Graphics3D[Prepend[tmp[[1]],
                  EdgeForm[RGBColor[0.1,0.,0.71]]],
                  PlotRange -> All,
                  Boxed -> False]], {3}];

Map[Show, WingBase];

The flapping of flexible wings

FlexibleWings = {};
Do[tmp = WingStep[tmp, N[Pi/28], mir];
FlexibleWings = Append[FlexibleWings,
                Graphics3D[Prepend[tmp[[1]],
                EdgeForm[RGBColor[.1, .0, .71]]],
                PlotRange -> All, Boxed -> False]], {16}];

Map[Show, FlexibleWings];