Debian Codegraph @

artsynth/Art_Speaker.cpp

raw symbols SCIP
1 /* Art_Speaker.cpp
2 *
3 * Copyright (C) 1992-2009,2011,2012,2014-2018,2021 Paul Boersma
4 *
5 * This code is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This code is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this work. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "Art_Speaker.h"cxx . . $ `<file>/artsynth/Art_Speaker.h`/
20
21 #define DLIPcxx . . $ `artsynth/Art_Speaker.cpp:21:9`! 5e-3
22
23 void Art_Speaker_toVocalTractcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b). (Artcxx . . $ Art# _art, Speakercxx . . $ Speaker# speaker,
24 double intX [], double intY [], double extX [], double extY [],
25 double *out_bodyX, double *out_bodyY)
26 {
27 double *art = _art -> artcxx . . $ structArt#art.;
28 double f = speaker -> relativeSizecxx . . $ structSpeaker#relativeSize. * 1e-3;
29 structcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0# { double xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#x., ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#y., dacxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#da.; } jaw;
30 structcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1# { double dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dx., dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dy.; } hyoid;
31 structcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2# { double xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#x., ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#y., rcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#r., radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius.; } body;
32 structcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3# { double xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#x., ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#y., rcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#r., acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#a.; } teeth;
33 structcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_4# { double acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_4#a.; } blade;
34 structcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_5# { double xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_5#x., ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_5#y., acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_5#a.; } tip;
35 structcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_6# { double dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_6#dx., dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_6#dy.; } lowerLip, upperLip;
36 double HBody_x, HBody_y, HC, Sp, p, a, b;
37
38 /* Determine the position of the hyoid bone (Mermelstein's H). */
39 /* The rest position is a characteristic of the speaker. */
40 /* The stylohyoid muscle pulls the hyoid bone up. */
41 /* The sternohyoid muscle pulls the hyoid bone down. */
42 /* The sphincter muscle pulls the hyoid bone backwards. */
43
44 hyoid.dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dx. = -5 * f * art [(int) kArt_musclecxx . . $ kArt_muscle#::SPHINCTERcxx . . $ kArt_muscle#SPHINCTER.];
45 hyoid.dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dy. = 20 * f * (art [(int) kArt_musclecxx . . $ kArt_muscle#::STYLOHYOIDcxx . . $ kArt_muscle#STYLOHYOID.]
46 - art [(int) kArt_musclecxx . . $ kArt_muscle#::STERNOHYOIDcxx . . $ kArt_muscle#STERNOHYOID.]);
47
48 /* The larynx moves up and down with the hyoid bone. */
49 /* Only the lowest point (Mermelstein's K) */
50 /* does not follow completely the horizontal movements. */
51
52 /* Anterior larynx. */
53 intX [1] = -14.0 * f + 0.5 * hyoid.dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dx.; intY [1] = -53.0 * f + hyoid.dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dy.;
54 /* Top of larynx. */
55 intX [2] = -20.0 * f + hyoid.dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dx.; intY [2] = -33.0 * f + hyoid.dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dy.;
56 /* Epiglottis. */
57 intX [3] = -20.0 * f + hyoid.dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dx.; intY [3] = -26.0 * f + hyoid.dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dy.;
58 /* Hyoid bone. */
59 intX [4] = -16.0 * f + hyoid.dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dx.; intY [4] = -26.0 * f + hyoid.dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dy.;
60 /* Posterior larynx. */
61 extX [1] = -22.0 * f + hyoid.dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dx.; extY [1] = -53.0 * f + hyoid.dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dy.;
62 /* Esophagus. */
63 extX [2] = -26.0 * f + hyoid.dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dx.; extY [2] = -40.0 * f + hyoid.dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_1#dy.;
64
65 /* The lower pharynx moves up and down with the hyoid bone. */
66 /* The lower constrictor muscle pulls the rear pharyngeal wall forwards. */
67
68 extX [3] = -34.0 * f + art [(int) kArt_musclecxx . . $ kArt_muscle#::SPHINCTERcxx . . $ kArt_muscle#SPHINCTER.] * (5.0 * f);
69 extY [3] = extY [2];
70
71 /* The upper pharynx is fixed at the height of the velum. */
72 /* The upper constrictor muscle pulls the rear pharyngeal wall forwards. */
73
74 extX [5] = -34.0 * f + art [(int) kArt_musclecxx . . $ kArt_muscle#::SPHINCTERcxx . . $ kArt_muscle#SPHINCTER.] * (5.0 * f);
75 extY [5] = speaker -> velumcxx . . $ structSpeaker#velum..ycxx . . $ structSpeaker_Velum#y.;
76
77 /* The height of the middle pharynx is in between the lower and upper pharynx. */
78 /* The middle constrictor muscle pulls the rear pharyngeal wall forwards. */
79
80 extX [4] = -34.0 * f + art [(int) kArt_musclecxx . . $ kArt_muscle#::SPHINCTERcxx . . $ kArt_muscle#SPHINCTER.] * (5.0 * f);
81 extY [4] = 0.5 * (extY [3] + extY [5]);
82
83 /* Tongue root. */
84
85 jaw.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#x. = -75.0 * f; // position of the condyle
86 jaw.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#y. = 53.0 * f;
87 jaw.dacxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#da. = art [(int) kArt_musclecxx . . $ kArt_muscle#::MASSETERcxx . . $ kArt_muscle#MASSETER.] * 0.15
88 - art [(int) kArt_musclecxx . . $ kArt_muscle#::MYLOHYOIDcxx . . $ kArt_muscle#MYLOHYOID.] * 0.20;
89 body.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#x. = jaw.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#x. + 81.0 * f * coscxx . . $ cos(fee4f1d22bc8e617). (-0.60 + jaw.dacxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#da.)
90 - art [(int) kArt_musclecxx . . $ kArt_muscle#::STYLOGLOSSUScxx . . $ kArt_muscle#STYLOGLOSSUS.] * (10.0 * f)
91 + art [(int) kArt_musclecxx . . $ kArt_muscle#::GENIOGLOSSUScxx . . $ kArt_muscle#GENIOGLOSSUS.] * (10.0 * f);
92 body.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#y. = jaw.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#y. + 81.0 * f * sincxx . . $ sin(fee4f1d22bc8e617). (-0.60 + jaw.dacxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#da.)
93 - art [(int) kArt_musclecxx . . $ kArt_muscle#::HYOGLOSSUScxx . . $ kArt_muscle#HYOGLOSSUS.] * (10.0 * f)
94 + art [(int) kArt_musclecxx . . $ kArt_muscle#::STYLOGLOSSUScxx . . $ kArt_muscle#STYLOGLOSSUS.] * (5.0 * f);
95 *out_bodyX = body.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#x.;
96 *out_bodyY = body.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#y.;
97 body.rcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#r. = hypotcxx . . $ hypot(b71928d39fde4295). (jaw.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#x. - body.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#x., jaw.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#y. - body.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#y.);
98 body.radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius. = 20.0 * f;
99 HBody_x = body.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#x. - intX [4];
100 HBody_y = body.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#y. - intY [4];
101 HC = hypotcxx . . $ hypot(b71928d39fde4295). (HBody_x, HBody_y);
102 if (HC <= body.radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius.) {
103 HC = body.radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius.;
104 Sp = 0.0; // prevent rounding errors in sqrt (can occur on processors with e.g. 80-bit registers)
105 } else
106 Sp = sqrtcxx . . $ sqrt(fee4f1d22bc8e617). (sqrcxx . . $ sqr(ada6a8422704cf8a). (HC) - sqrcxx . . $ sqr(ada6a8422704cf8a). (body.radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius.));
107 a = atan2cxx . . $ atan2(b71928d39fde4295). (HBody_y, HBody_x);
108 b = asincxx . . $ asin(fee4f1d22bc8e617). (body.radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius. / HC);
109 p = 0.57 * (34.8 * f - Sp);
110 intX [5] = intX [4] + 0.5 * Sp * coscxx . . $ cos(fee4f1d22bc8e617). (a + b) - p * sincxx . . $ sin(fee4f1d22bc8e617). (a + b);
111 intY [5] = intY [4] + 0.5 * Sp * sincxx . . $ sin(fee4f1d22bc8e617). (a + b) + p * coscxx . . $ cos(fee4f1d22bc8e617). (a + b);
112 HBody_x = body.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#x. - intX [5];
113 HBody_y = body.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#y. - intY [5];
114 HC = hypotcxx . . $ hypot(b71928d39fde4295). (HBody_x, HBody_y);
115 if (HC <= body.radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius.) {
116 HC = body.radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius.;
117 Sp = 0.0;
118 } else
119 Sp = sqrtcxx . . $ sqrt(fee4f1d22bc8e617). (sqrcxx . . $ sqr(ada6a8422704cf8a). (HC) - sqrcxx . . $ sqr(ada6a8422704cf8a). (body.radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius.));
120 a = atan2cxx . . $ atan2(b71928d39fde4295). (HBody_y, HBody_x);
121 b = asincxx . . $ asin(fee4f1d22bc8e617). (body.radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius. / HC);
122 intX [6] = intX [5] + Sp * coscxx . . $ cos(fee4f1d22bc8e617). (a + b);
123 intY [6] = intY [5] + Sp * sincxx . . $ sin(fee4f1d22bc8e617). (a + b);
124
125 /* Posterior blade. */
126
127 teeth.acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#a. = speaker -> lowerTeethcxx . . $ structSpeaker#lowerTeeth..acxx . . $ structSpeaker_LowerTeeth#a. + jaw.dacxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#da.;
128 intX [7] = body.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#x. + body.radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius. * coscxx . . $ cos(fee4f1d22bc8e617). (1.73 + teeth.acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#a.);
129 intY [7] = body.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#y. + body.radiuscxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#radius. * sincxx . . $ sin(fee4f1d22bc8e617). (1.73 + teeth.acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#a.);
130
131 /* Tip. */
132
133 tip.acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_5#a. = (art [(int) kArt_musclecxx . . $ kArt_muscle#::UPPER_TONGUEcxx . . $ kArt_muscle#UPPER_TONGUE.]
134 - art [(int) kArt_musclecxx . . $ kArt_muscle#::LOWER_TONGUEcxx . . $ kArt_muscle#LOWER_TONGUE.]) * 1.0;
135 blade.acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_4#a. = teeth.acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#a.
136 + 0.004 * (body.rcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_2#r. - speaker -> neutralBodyDistancecxx . . $ structSpeaker#neutralBodyDistance.) + tip.acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_5#a.;
137 intX [8] = intX [7] + speaker -> tipcxx . . $ structSpeaker#tip..lengthcxx . . $ structSpeaker_Tip#length. * coscxx . . $ cos(fee4f1d22bc8e617). (blade.acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_4#a.);
138 intY [8] = intY [7] + speaker -> tipcxx . . $ structSpeaker#tip..lengthcxx . . $ structSpeaker_Tip#length. * sincxx . . $ sin(fee4f1d22bc8e617). (blade.acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_4#a.);
139
140 /* Jaw. */
141
142 teeth.rcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#r. = speaker -> lowerTeethcxx . . $ structSpeaker#lowerTeeth..rcxx . . $ structSpeaker_LowerTeeth#r.;
143 teeth.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#x. = jaw.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#x. + teeth.rcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#r. * coscxx . . $ cos(fee4f1d22bc8e617). (teeth.acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#a.);
144 teeth.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#y. = jaw.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_0#y. + teeth.rcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#r. * sincxx . . $ sin(fee4f1d22bc8e617). (teeth.acxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#a.);
145 intX [9] = teeth.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#x. + speaker -> teethCavitycxx . . $ structSpeaker#teethCavity..dx1cxx . . $ structSpeaker_TeethCavity#dx1.;
146 intY [9] = teeth.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#y. + speaker -> teethCavitycxx . . $ structSpeaker#teethCavity..dycxx . . $ structSpeaker_TeethCavity#dy.;
147 intX [10] = teeth.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#x. + speaker -> teethCavitycxx . . $ structSpeaker#teethCavity..dx2cxx . . $ structSpeaker_TeethCavity#dx2.;
148 intY [10] = intY [9];
149 intX [11] = teeth.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#x.;
150 intY [11] = teeth.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#y.;
151
152 /* Lower lip. */
153
154 lowerLip.dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_6#dx. = speaker -> lowerLipcxx . . $ structSpeaker#lowerLip..dxcxx . . $ structSpeaker_Lip#dx. + art [(int) kArt_musclecxx . . $ kArt_muscle#::ORBICULARIS_ORIScxx . . $ kArt_muscle#ORBICULARIS_ORIS.] * 0.02 - 5e-3;
155 lowerLip.dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_6#dy. = speaker -> lowerLipcxx . . $ structSpeaker#lowerLip..dycxx . . $ structSpeaker_Lip#dy. + art [(int) kArt_musclecxx . . $ kArt_muscle#::ORBICULARIS_ORIScxx . . $ kArt_muscle#ORBICULARIS_ORIS.] * 0.01;
156 intX [12] = teeth.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#x.;
157 intY [12] = teeth.ycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#y. + lowerLip.dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_6#dy.;
158 intX [13] = teeth.xcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_3#x. + lowerLip.dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_6#dx.;
159 intY [13] = intY [12];
160
161 /* Velum. */
162
163 extX [6] = speaker -> velumcxx . . $ structSpeaker#velum..xcxx . . $ structSpeaker_Velum#x.;
164 extY [6] = speaker -> velumcxx . . $ structSpeaker#velum..ycxx . . $ structSpeaker_Velum#y.;
165
166 /* Palate. */
167
168 extX [7] = speaker -> alveolicxx . . $ structSpeaker#alveoli..xcxx . . $ structSpeaker_Alveoli#x.;
169 extY [7] = speaker -> alveolicxx . . $ structSpeaker#alveoli..ycxx . . $ structSpeaker_Alveoli#y.;
170 extX [8] = speaker -> upperTeethcxx . . $ structSpeaker#upperTeeth..xcxx . . $ structSpeaker_UpperTeeth#x.;
171 extY [8] = speaker -> upperTeethcxx . . $ structSpeaker#upperTeeth..ycxx . . $ structSpeaker_UpperTeeth#y.;
172
173 /* Upper lip. */
174
175 upperLip.dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_6#dx. = speaker -> upperLipcxx . . $ structSpeaker#upperLip..dxcxx . . $ structSpeaker_Lip#dx. + art [(int) kArt_musclecxx . . $ kArt_muscle#::ORBICULARIS_ORIScxx . . $ kArt_muscle#ORBICULARIS_ORIS.] * 0.02 - 5e-3;
176 upperLip.dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_6#dy. = speaker -> upperLipcxx . . $ structSpeaker#upperLip..dycxx . . $ structSpeaker_Lip#dy. - art [(int) kArt_musclecxx . . $ kArt_muscle#::ORBICULARIS_ORIScxx . . $ kArt_muscle#ORBICULARIS_ORIS.] * 0.01;
177 extX [9] = extX [8];
178 extY [9] = extY [8] + upperLip.dycxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_6#dy.;
179 extX [10] = extX [9] + upperLip.dxcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b).$anonymous_type_6#dx.;
180 extY [10] = extY [9];
181 extX [11] = extX [10] + 5e-3;
182 extY [11] = extY [10] + DLIPcxx . . $ `artsynth/Art_Speaker.cpp:21:9`!;
183
184 /* Chin. */
185
186 intX [14] = intX [13] + 5e-3;
187 intY [14] = intY [13] - DLIPcxx . . $ `artsynth/Art_Speaker.cpp:21:9`!;
188 intX [15] = intX [11] + 0.5e-2;
189 intY [15] = intY [11] - 3.0e-2;
190 intX [16] = intX [1];
191 intY [16] = intY [1];
192 }
193
194 void Art_Speaker_drawcxx . . $ Art_Speaker_draw(f3b734e345fa3399). (Artcxx . . $ Art# art, Speakercxx . . $ Speaker# speaker, Graphicscxx . . $ Graphics# g) {
195 const double f = speaker -> relativeSizecxx . . $ structSpeaker#relativeSize. * 1e-3;
196 double intX [1 + 16], intY [1 + 16], extX [1 + 11], extY [1 + 11];
197 double bodyX, bodyY;
198 Art_Speaker_toVocalTractcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b). (art, speaker, intX, intY, extX, extY, & bodyX, & bodyY);
199 const Graphics_Viewportcxx . . $ Graphics_Viewport# previous = Graphics_insetViewportcxx . . $ Graphics_insetViewport(b48873d7bfae0d92). (g, 0.1, 0.9, 0.1, 0.9);
200 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (g, -0.05, 0.05, -0.05, 0.05);
201
202 /* Draw inner contour. */
203
204 for (integercxx . . $ integer# i = 1; i <= 5; i ++)
205 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, intX [i], intY [i], intX [i + 1], intY [i + 1]);
206 Graphics_arccxx . . $ Graphics_arc(9d9e8b5bd1d9d21f). (g, bodyX, bodyY, 20.0 * f,
207 atan2cxx . . $ atan2(b71928d39fde4295). (intY [7] - bodyY, intX [7] - bodyX) * (180.0 / NUMpicxx . . $ NUMpi.),
208 atan2cxx . . $ atan2(b71928d39fde4295). (intY [6] - bodyY, intX [6] - bodyX) * (180.0 / NUMpicxx . . $ NUMpi.));
209 for (integercxx . . $ integer# i = 7; i <= 15; i ++)
210 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, intX [i], intY [i], intX [i + 1], intY [i + 1]);
211
212 /* Draw outer contour. */
213
214 for (integercxx . . $ integer# i = 1; i <= 5; i ++)
215 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, extX [i], extY [i], extX [i + 1], extY [i + 1]);
216 Graphics_arccxx . . $ Graphics_arc(9d9e8b5bd1d9d21f). (g, 0.0, 0.0, speaker -> palatecxx . . $ structSpeaker#palate..radiuscxx . . $ structSpeaker_Palate#radius.,
217 speaker -> alveolicxx . . $ structSpeaker#alveoli..acxx . . $ structSpeaker_Alveoli#a. * (180.0 / NUMpicxx . . $ NUMpi.),
218 speaker -> velumcxx . . $ structSpeaker#velum..acxx . . $ structSpeaker_Velum#a. * (180.0 / NUMpicxx . . $ NUMpi.));
219 for (integercxx . . $ integer# i = 7; i <= 10; i ++)
220 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (g, extX [i], extY [i], extX [i + 1], extY [i + 1]);
221 Graphics_resetViewportcxx . . $ Graphics_resetViewport(620f27fff4cd4a03). (g, previous);
222 }
223
224 void Art_Speaker_fillInnerContourcxx . . $ Art_Speaker_fillInnerContour(f3b734e345fa3399). (Artcxx . . $ Art# art, Speakercxx . . $ Speaker# speaker, Graphicscxx . . $ Graphics# g) {
225 const double f = speaker -> relativeSizecxx . . $ structSpeaker#relativeSize. * 1e-3;
226 double intX [1 + 16], intY [1 + 16], extX [1 + 11], extY [1 + 11];
227 double x [1 + 16], y [1 + 16];
228 double bodyX, bodyY;
229 Art_Speaker_toVocalTractcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b). (art, speaker, intX, intY, extX, extY, & bodyX, & bodyY);
230 const Graphics_Viewportcxx . . $ Graphics_Viewport# previous = Graphics_insetViewportcxx . . $ Graphics_insetViewport(b48873d7bfae0d92). (g, 0.1, 0.9, 0.1, 0.9);
231 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (g, -0.05, 0.05, -0.05, 0.05);
232 for (integercxx . . $ integer# i = 1; i <= 16; i ++) {
233 x [i] = intX [i];
234 y [i] = intY [i];
235 }
236 Graphics_setGreycxx . . $ Graphics_setGrey(2514a1c07b6be5e2). (g, 0.8);
237 Graphics_fillAreacxx . . $ Graphics_fillArea(23a712ce109b96e0). (g, 16, & x [1], & y [1]);
238 Graphics_fillCirclecxx . . $ Graphics_fillCircle(8752bb7a78272ca7). (g, bodyX, bodyY, 20.0 * f);
239 Graphics_setGreycxx . . $ Graphics_setGrey(2514a1c07b6be5e2). (g, 0.0);
240 Graphics_resetViewportcxx . . $ Graphics_resetViewport(620f27fff4cd4a03). (g, previous);
241 }
242
243 static double arcLengthcxx . . $ arcLength(d8e7e0733fa41c87). (double from, double to) {
244 double result = to - from;
245 while (result > 0.0)
246 result -= 2.0 * NUMpicxx . . $ NUMpi.;
247 while (result < 0.0)
248 result += 2.0 * NUMpicxx . . $ NUMpi.;
249 return result;
250 }
251
252 static int Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount. = 27;
253 static double bodyXcxx . . $ bodyX., bodyYcxx . . $ bodyY., bodyRadiuscxx . . $ bodyRadius.;
254
255 static double toLinecxx . . $ toLine(760dce1846732e11). (double x, double y, const double intX [], const double intY [], integercxx . . $ integer# i) {
256 integercxx . . $ integer# nearby;
257 if (i == 6) {
258 const double a7 = atan2cxx . . $ atan2(b71928d39fde4295). (intY [7] - bodyYcxx . . $ bodyY., intX [7] - bodyXcxx . . $ bodyX.);
259 const double a6 = atan2cxx . . $ atan2(b71928d39fde4295). (intY [6] - bodyYcxx . . $ bodyY., intX [6] - bodyXcxx . . $ bodyX.);
260 const double a = atan2cxx . . $ atan2(b71928d39fde4295). (y - bodyYcxx . . $ bodyY., x - bodyXcxx . . $ bodyX.);
261 const double da6 = arcLengthcxx . . $ arcLength(d8e7e0733fa41c87). (a7, a6);
262 const double da = arcLengthcxx . . $ arcLength(d8e7e0733fa41c87). (a7, a);
263 if (da <= da6)
264 return fabscxx . . $ fabs(fee4f1d22bc8e617). (hypotcxx . . $ hypot(b71928d39fde4295). (bodyXcxx . . $ bodyX. - x, bodyYcxx . . $ bodyY. - y) - bodyRadiuscxx . . $ bodyRadius.);
265 else
266 nearby = ( arcLengthcxx . . $ arcLength(d8e7e0733fa41c87). (a7 + 0.5 * da6, a) < NUMpicxx . . $ NUMpi. ? 6 : 7 );
267 } else if ((x - intX [i]) * (intX [i + 1] - intX [i]) +
268 (y - intY [i]) * (intY [i + 1] - intY [i]) < 0) {
269 nearby = i;
270 } else if ((x - intX [i + 1]) * (intX [i] - intX [i + 1]) +
271 (y - intY [i + 1]) * (intY [i] - intY [i + 1]) < 0) {
272 nearby = i + 1;
273 } else {
274 const double boundaryDistance = hypotcxx . . $ hypot(b71928d39fde4295). (intX [i + 1] - intX [i], intY [i + 1] - intY [i]);
275 const double outerProduct = (intX [i] - x) * (intY [i + 1] - intY [i]) - (intY [i] - y) * (intX [i + 1] - intX [i]);
276 return fabscxx . . $ fabs(fee4f1d22bc8e617). (outerProduct) / boundaryDistance;
277 }
278 return hypotcxx . . $ hypot(b71928d39fde4295). (intX [nearby] - x, intY [nearby] - y);
279 }
280
281 static int insidecxx . . $ inside(dace0b72fe015015). (double x, double y,
282 const double intX [], const double intY [])
283 {
284 integercxx . . $ integer# up = 0;
285 for (integercxx . . $ integer# i = 1; i <= 16 - 1; i ++)
286 if ((y > intY [i]) != (y > intY [i + 1])) {
287 const double slope = (intX [i + 1] - intX [i]) / (intY [i + 1] - intY [i]);
288 if (x > intX [i] + (y - intY [i]) * slope)
289 up += ( y > intY [i] ? 1 : -1 );
290 }
291 return up != 0 || bodyRadiuscxx . . $ bodyRadius. * bodyRadiuscxx . . $ bodyRadius. > sqrcxx . . $ sqr(ada6a8422704cf8a). (x - bodyXcxx . . $ bodyX.) + sqrcxx . . $ sqr(ada6a8422704cf8a). (y - bodyYcxx . . $ bodyY.);
292 }
293
294 void Art_Speaker_meshVocalTractcxx . . $ Art_Speaker_meshVocalTract(75285077b25cabf8). (Artcxx . . $ Art# art, Speakercxx . . $ Speaker# speaker,
295 double xi [], double yi [], double xe [], double ye [],
296 double xmm [], double ymm [], bool closed [])
297 {
298 double f = speaker -> relativeSizecxx . . $ structSpeaker#relativeSize. * 1e-3;
299 double intX [1 + 16], intY [1 + 16], extX [1 + 11], extY [1 + 11], d_angle;
300 double xm [40], ym [40];
301
302 Art_Speaker_toVocalTractcxx . . $ Art_Speaker_toVocalTract(22f997049550dd3b). (art, speaker, intX, intY, extX, extY, & bodyXcxx . . $ bodyX., & bodyYcxx . . $ bodyY.);
303 bodyRadiuscxx . . $ bodyRadius. = 20.0 * f;
304
305 xe [1] = extX [1]; // eq. 5.45
306 ye [1] = extY [1];
307 xe [2] = 0.2 * extX [2] + 0.8 * extX [1];
308 ye [2] = 0.2 * extY [2] + 0.8 * extY [1];
309 xe [3] = 0.6 * extX [2] + 0.4 * extX [1];
310 ye [3] = 0.6 * extY [2] + 0.4 * extY [1];
311 xe [4] = 0.9 * extX [3] + 0.1 * extX [4]; // eq. 5.46
312 ye [4] = 0.9 * extY [3] + 0.1 * extY [4];
313 xe [5] = 0.7 * extX [3] + 0.3 * extX [4];
314 ye [5] = 0.7 * extY [3] + 0.3 * extY [4];
315 xe [6] = 0.5 * extX [3] + 0.5 * extX [4];
316 ye [6] = 0.5 * extY [3] + 0.5 * extY [4];
317 xe [7] = 0.3 * extX [3] + 0.7 * extX [4];
318 ye [7] = 0.3 * extY [3] + 0.7 * extY [4];
319 xe [8] = 0.1 * extX [3] + 0.9 * extX [4];
320 ye [8] = 0.1 * extY [3] + 0.9 * extY [4];
321 xe [9] = 0.9 * extX [4] + 0.1 * extX [5];
322 ye [9] = 0.9 * extY [4] + 0.1 * extY [5];
323 xe [10] = 0.7 * extX [4] + 0.3 * extX [5];
324 ye [10] = 0.7 * extY [4] + 0.3 * extY [5];
325 xe [11] = 0.5 * extX [4] + 0.5 * extX [5];
326 ye [11] = 0.5 * extY [4] + 0.5 * extY [5];
327 xe [12] = 0.3 * extX [4] + 0.7 * extX [5];
328 ye [12] = 0.3 * extY [4] + 0.7 * extY [5];
329 xe [13] = 0.1 * extX [4] + 0.9 * extX [5];
330 ye [13] = 0.1 * extY [4] + 0.9 * extY [5];
331 d_angle = (atan2cxx . . $ atan2(b71928d39fde4295). (ye [13], xe [13]) - 0.5 * NUMpicxx . . $ NUMpi.) / 6; // eq. 5.47
332 for (integercxx . . $ integer# i = 14; i <= 18; i ++) {
333 double a = 0.5 * NUMpicxx . . $ NUMpi. + (19 - i) * d_angle;
334 xe [i] = speaker -> palatecxx . . $ structSpeaker#palate..radiuscxx . . $ structSpeaker_Palate#radius. * coscxx . . $ cos(fee4f1d22bc8e617). (a);
335 ye [i] = speaker -> palatecxx . . $ structSpeaker#palate..radiuscxx . . $ structSpeaker_Palate#radius. * sincxx . . $ sin(fee4f1d22bc8e617). (a);
336 }
337 xe [19] = 0;
338 ye [19] = speaker -> palatecxx . . $ structSpeaker#palate..radiuscxx . . $ structSpeaker_Palate#radius.;
339 xe [20] = 0.25 * extX [7];
340 xe [21] = 0.50 * extX [7];
341 xe [22] = 0.75 * extX [7];
342 for (integercxx . . $ integer# i = 20; i <= 22; i ++) {
343 ye [i] = speaker -> palatecxx . . $ structSpeaker#palate..radiuscxx . . $ structSpeaker_Palate#radius. * sqrtcxx . . $ sqrt(fee4f1d22bc8e617). (1.0 - xe [i] * xe [i] /
344 (speaker -> palatecxx . . $ structSpeaker#palate..radiuscxx . . $ structSpeaker_Palate#radius. * speaker -> palatecxx . . $ structSpeaker#palate..radiuscxx . . $ structSpeaker_Palate#radius.));
345 }
346 xe [23] = extX [7];
347 ye [23] = extY [7];
348 xe [24] = 0.5 * (extX [7] + extX [8]);
349 ye [24] = 0.5 * (extY [7] + extY [8]);
350 xe [25] = extX [8];
351 ye [25] = extY [8];
352 xe [26] = 0.25 * extX [11] + 0.75 * extX [9];
353 xe [27] = 0.75 * extX [11] + 0.25 * extX [9];
354 ye [26] = extY [10];
355 ye [27] = 0.5 * (extY [10] + extY [11]);
356 for (integercxx . . $ integer# i = 1; i <= 27; i ++) { // every mesh point
357 double minimum = 100000.0;
358 for (integercxx . . $ integer# j = 1; j <= 15 - 1; j ++) { // every internal segment
359 double d = toLinecxx . . $ toLine(760dce1846732e11). (xe [i], ye [i], intX, intY, j);
360 if (d < minimum) minimum = d;
361 }
362 if (( closed [i] = insidecxx . . $ inside(dace0b72fe015015). (xe [i], ye [i], intX, intY) ))
363 minimum = - minimum;
364 if (xe [i] >= 0.0) { // vertical line pieces
365 xi [i] = xe [i];
366 yi [i] = ye [i] - minimum;
367 } else if (ye [i] <= 0.0) { // horizontal line pieces
368 xi [i] = xe [i] + minimum;
369 yi [i] = ye [i];
370 } else { // radial line pieces, centre = centre of palate arc
371 double angle = atan2cxx . . $ atan2(b71928d39fde4295). (ye [i], xe [i]);
372 xi [i] = xe [i] - minimum * coscxx . . $ cos(fee4f1d22bc8e617). (angle);
373 yi [i] = ye [i] - minimum * sincxx . . $ sin(fee4f1d22bc8e617). (angle);
374 }
375 }
376 for (integercxx . . $ integer# i = 1; i <= Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount.; i ++) {
377 xm [i] = 0.5 * (xe [i] + xi [i]);
378 ym [i] = 0.5 * (ye [i] + yi [i]);
379 }
380 for (integercxx . . $ integer# i = 2; i <= Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount.; i ++) {
381 xmm [i] = 0.5 * (xm [i - 1] + xm [i]);
382 ymm [i] = 0.5 * (ym [i - 1] + ym [i]);
383 }
384 xmm [1] = 2.0 * xm [1] - xmm [2];
385 ymm [1] = 2.0 * ym [1] - ymm [2];
386 xmm [Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount. + 1] = 2.0 * xm [Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount.]
387 - xmm [Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount.];
388 ymm [Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount. + 1] = 2.0 * ym [Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount.]
389 - ymm [Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount.];
390 }
391
392 void Art_Speaker_drawMeshcxx . . $ Art_Speaker_drawMesh(f3b734e345fa3399). (Artcxx . . $ Art# art, Speakercxx . . $ Speaker# speaker, Graphicscxx . . $ Graphics# graphics) {
393 double xi [40], yi [40], xe [40], ye [40], xmm [40], ymm [40];
394 bool closed [40];
395 int oldLineType = Graphics_inqLineTypecxx . . $ Graphics_inqLineType(d4bbe1b9daaaf11b). (graphics);
396 Art_Speaker_meshVocalTractcxx . . $ Art_Speaker_meshVocalTract(75285077b25cabf8). (art, speaker, xi, yi, xe, ye, xmm, ymm, closed);
397 Graphics_Viewportcxx . . $ Graphics_Viewport# previous = Graphics_insetViewportcxx . . $ Graphics_insetViewport(b48873d7bfae0d92). (graphics, 0.1, 0.9, 0.1, 0.9); // must be square
398 Graphics_setWindowcxx . . $ Graphics_setWindow(72bdb7937dbb13da). (graphics, -0.05, 0.05, -0.05, 0.05);
399
400 /* Mesh lines. */
401 for (integercxx . . $ integer# i = 1; i <= Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount.; i ++)
402 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (graphics, xi [i], yi [i], xe [i], ye [i]);
403
404 /* Radii. */
405 Graphics_setLineTypecxx . . $ Graphics_setLineType(9abe41586e87648d). (graphics, Graphics_DOTTEDcxx . . $ `sys/Graphics.h:288:9`!);
406 for (integercxx . . $ integer# i = 1; i <= Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount.; i ++)
407 if (xe [i] <= 0.0 && ye [i] >= 0.0)
408 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (graphics, 0.0, 0.0, 0.9 * xi [i], 0.9 * yi [i]);
409 Graphics_setLineTypecxx . . $ Graphics_setLineType(9abe41586e87648d). (graphics, oldLineType);
410
411 /* Lengths. */
412 for (integercxx . . $ integer# i = 1; i <= Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount.; i ++)
413 Graphics_linecxx . . $ Graphics_line(72bdb7937dbb13da). (graphics, xmm [i], ymm [i], xmm [i + 1], ymm [i + 1]);
414
415 for (integercxx . . $ integer# i = 1; i <= Art_Speaker_meshCountcxx . . $ Art_Speaker_meshCount. + 1; i ++)
416 Graphics_specklecxx . . $ Graphics_speckle(c84ba9158791aef6). (graphics, xmm [i], ymm [i]);
417 Graphics_setTextAlignmentcxx . . $ Graphics_setTextAlignment(a697afee548943ae). (graphics, Graphics_LEFTcxx . . $ `sys/Graphics.h:249:9`!, Graphics_HALFcxx . . $ `sys/Graphics.h:253:9`!);
418 Graphics_textcxx . . $ Graphics_text(8e1820bb471fc8c8). (graphics, 0.0, 0.0, U"O"); // origin
419 Graphics_resetViewportcxx . . $ Graphics_resetViewport(620f27fff4cd4a03). (graphics, previous);
420 }
421
422 /* End of file Art_Speaker.cpp */