| 1 | /****************************************************************************/cxx . . $ `<file>/src/medit/ellipse.c`/ |
| 2 | /* This file is part of FreeFEM. */ |
| 3 | /* */ |
| 4 | /* FreeFEM is free software: you can redistribute it and/or modify */ |
| 5 | /* it under the terms of the GNU Lesser General Public License as */ |
| 6 | /* published by the Free Software Foundation, either version 3 of */ |
| 7 | /* the License, or (at your option) any later version. */ |
| 8 | /* */ |
| 9 | /* FreeFEM is distributed in the hope that it will be useful, */ |
| 10 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 11 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 12 | /* GNU Lesser General Public License for more details. */ |
| 13 | /* */ |
| 14 | /* You should have received a copy of the GNU Lesser General Public License */ |
| 15 | /* along with FreeFEM. If not, see <http://www.gnu.org/licenses/>. */ |
| 16 | /****************************************************************************/ |
| 17 | /* SUMMARY : ... */ |
| 18 | /* LICENSE : LGPLv3 */ |
| 19 | /* ORG : LJLL Universite Pierre et Marie Curie, Paris, FRANCE */ |
| 20 | /* AUTHORS : Pascal Frey */ |
| 21 | /* E-MAIL : [email protected] */ |
| 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | #include "medit.h"cxx . . $ `<file>/src/medit/medit.h`/ |
| 28 | #include "extern.h"cxx . . $ `<file>/src/medit/extern.h`/ |
| 29 | #include "sproto.h"cxx . . $ `<file>/src/medit/sproto.h`/ |
| 30 | #include "eigenv.h"cxx . . $ `<file>/src/medit/eigenv.h`/ |
| 31 | |
| 32 | #ifndef M_PI2 |
| 33 | #define M_PI2cxx . . $ `src/medit/ellipse.c:33:9`! (2.0 * M_PI) |
| 34 | #endif |
| 35 | |
| 36 | extern int refmatcxx . . $ refmat.; |
| 37 | extern int eigen2cxx . . $ eigen2(5857e2113237355).(double m[3], double lambda[2], double vp[2][2]); |
| 38 | static GLfloatcxx . . $ GLfloat# IdMatrixcxx . . $ IdMatrix.[16] = {1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, |
| 39 | 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0}; |
| 40 | |
| 41 | void drawEllipsoidcxx . . $ drawEllipsoid(f8510699cb40afa3).(pScenecxx . . $ pScene# sc, pMeshcxx . . $ pMesh# mesh, int typel, int k) { |
| 42 | pMaterialcxx . . $ pMaterial# pm; |
| 43 | pSolutioncxx . . $ pSolution# ps; |
| 44 | pTrianglecxx . . $ pTriangle# pt; |
| 45 | pTetracxx . . $ pTetra# pt1; |
| 46 | pPointcxx . . $ pPoint# p0; |
| 47 | GLfloatcxx . . $ GLfloat# mat[16], cx, cy, cz; |
| 48 | double m[6], lambda[3], v[3][3]; |
| 49 | int i, j, l; |
| 50 | |
| 51 | /* compute average size */ |
| 52 | if (mesh->nfieldcxx . . $ mesh#nfield. != 6 || !mesh->nbbcxx . . $ mesh#nbb.) return; |
| 53 | |
| 54 | /* draw average ellipse at element */ |
| 55 | if (typel == LPointcxx . . $ LPoint.) { |
| 56 | int iord; |
| 57 | |
| 58 | p0 = &mesh->pointcxx . . $ mesh#point.[k]; |
| 59 | pm = &sc->materialcxx . . $ scene#material.[p0->refcxx . . $ spoint#ref.]; |
| 60 | ps = &mesh->solcxx . . $ mesh#sol.[k]; |
| 61 | |
| 62 | for (j = 0; j < 6; j++) { |
| 63 | m[j] = ps->mcxx . . $ solu#m.[j]; |
| 64 | } |
| 65 | |
| 66 | iord = eigenvcxx . . $ eigenv(73317bed5d940d7e).(1, m, lambda, v); |
| 67 | if (!iord) return; |
| 68 | |
| 69 | if (mesh->necxx . . $ mesh#ne.) { |
| 70 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, " Eigenvectors :\n vp1 : %f %f %f\n", v[0][0], v[0][1], v[0][2]); |
| 71 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, " vp2 : %f %f %f\n", v[1][0], v[1][1], v[1][2]); |
| 72 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, " vp3 : %f %f %f\n", v[2][0], v[2][1], v[2][2]); |
| 73 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, " Eigenvalues : %f %f %f %d\n", lambda[0], lambda[1], lambda[2], iord); |
| 74 | if (lambda[0] <= 0.0 || lambda[1] <= 0.0 || lambda[2] <= 0.0) return; |
| 75 | |
| 76 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, " Sizes : %f %f %f\n", 1.0 / sqrt(lambda[0]), 1.0 / sqrt(lambda[1]), |
| 77 | 1.0 / sqrt(lambda[2])); |
| 78 | } else if (lambda[0] <= 0.0 || lambda[1] <= 0.0 || lambda[2] <= 0.0) { |
| 79 | return; |
| 80 | } |
| 81 | |
| 82 | lambda[0] = maxcxx . . $ `src/medit/medit.h:91:9`!(EPScxx . . $ `src/medit/medit.h:72:9`!, 0.5 / sqrt(lambda[0])); |
| 83 | lambda[1] = maxcxx . . $ `src/medit/medit.h:91:9`!(EPScxx . . $ `src/medit/medit.h:72:9`!, 0.5 / sqrt(lambda[1])); |
| 84 | lambda[2] = maxcxx . . $ `src/medit/medit.h:91:9`!(EPScxx . . $ `src/medit/medit.h:72:9`!, 0.5 / sqrt(lambda[2])); |
| 85 | memcpycxx . . $ memcpy(cc817cb175f282d).(mat, IdMatrixcxx . . $ IdMatrix., 16 * sizeof(GLfloatcxx . . $ GLfloat#)); |
| 86 | |
| 87 | for (j = 0; j < 3; j++) { |
| 88 | for (l = 0; l < 3; l++) { |
| 89 | mat[j * 4 + l] = v[j][l]; |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | glDisablecxx . . $ glDisable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 94 | glPushMatrixcxx . . $ glPushMatrix(49f6e7a06ebc5aa8).( ); |
| 95 | glColor4fvcxx . . $ glColor4fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 96 | glTranslatefcxx . . $ glTranslatef(bd1040fe176e0786).(p0->ccxx . . $ spoint#c.[0], p0->ccxx . . $ spoint#c.[1], p0->ccxx . . $ spoint#c.[2]); |
| 97 | glMultMatrixfcxx . . $ glMultMatrixf(de58861cad56015a).(mat); |
| 98 | glScalefcxx . . $ glScalef(bd1040fe176e0786).(lambda[0], lambda[1], lambda[2]); |
| 99 | glutWireSpherecxx . . $ glutWireSphere(33fe0831888804d8).(1., 30, 30); |
| 100 | glPopMatrixcxx . . $ glPopMatrix(49f6e7a06ebc5aa8).( ); |
| 101 | glEnablecxx . . $ glEnable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 102 | } else if (typel == LTriacxx . . $ LTria.) { |
| 103 | pt = &mesh->triacxx . . $ mesh#tria.[k]; |
| 104 | if (mesh->nbbcxx . . $ mesh#nbb. == mesh->npcxx . . $ mesh#np.) |
| 105 | pm = &sc->materialcxx . . $ scene#material.[refmatcxx . . $ refmat.]; |
| 106 | else if (mesh->nbbcxx . . $ mesh#nbb. == mesh->ntcxx . . $ mesh#nt.) |
| 107 | pm = &sc->materialcxx . . $ scene#material.[k]; |
| 108 | else |
| 109 | return; |
| 110 | |
| 111 | glColor4fvcxx . . $ glColor4fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 112 | |
| 113 | for (j = 0; j < 6; j++) { |
| 114 | m[j] = 0.; |
| 115 | } |
| 116 | |
| 117 | cx = cy = cz = 0.0; |
| 118 | |
| 119 | for (i = 0; i < 3; i++) { |
| 120 | ps = &mesh->solcxx . . $ mesh#sol.[pt->vcxx . . $ striangle#v.[i]]; |
| 121 | p0 = &mesh->pointcxx . . $ mesh#point.[pt->vcxx . . $ striangle#v.[i]]; |
| 122 | cx += p0->ccxx . . $ spoint#c.[0]; |
| 123 | cy += p0->ccxx . . $ spoint#c.[1]; |
| 124 | cz += p0->ccxx . . $ spoint#c.[2]; |
| 125 | |
| 126 | for (j = 0; j < 6; j++) { |
| 127 | m[j] += ps->mcxx . . $ solu#m.[j]; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | cx /= 3.; |
| 132 | cy /= 3.; |
| 133 | cz /= 3.; |
| 134 | |
| 135 | for (j = 0; j < 6; j++) { |
| 136 | m[j] /= 6.; |
| 137 | } |
| 138 | |
| 139 | if (!eigenvcxx . . $ eigenv(73317bed5d940d7e).(1, m, lambda, v)) return; |
| 140 | |
| 141 | lambda[0] = maxcxx . . $ `src/medit/medit.h:91:9`!(EPScxx . . $ `src/medit/medit.h:72:9`!, 0.5 / sqrt(lambda[0])); |
| 142 | lambda[1] = maxcxx . . $ `src/medit/medit.h:91:9`!(EPScxx . . $ `src/medit/medit.h:72:9`!, 0.5 / sqrt(lambda[1])); |
| 143 | lambda[2] = maxcxx . . $ `src/medit/medit.h:91:9`!(EPScxx . . $ `src/medit/medit.h:72:9`!, 0.5 / sqrt(lambda[2])); |
| 144 | |
| 145 | memcpycxx . . $ memcpy(cc817cb175f282d).(mat, IdMatrixcxx . . $ IdMatrix., 16 * sizeof(GLfloatcxx . . $ GLfloat#)); |
| 146 | |
| 147 | for (j = 0; j < 3; j++) { |
| 148 | for (l = 0; l < 3; l++) { |
| 149 | mat[j * 4 + l] = v[j][l]; |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | glDisablecxx . . $ glDisable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 154 | glPushMatrixcxx . . $ glPushMatrix(49f6e7a06ebc5aa8).( ); |
| 155 | glColor4fvcxx . . $ glColor4fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 156 | glTranslatefcxx . . $ glTranslatef(bd1040fe176e0786).(cx, cy, cz); |
| 157 | glMultMatrixfcxx . . $ glMultMatrixf(de58861cad56015a).(mat); |
| 158 | glScalefcxx . . $ glScalef(bd1040fe176e0786).(lambda[0], lambda[1], lambda[2]); |
| 159 | glutWireSpherecxx . . $ glutWireSphere(33fe0831888804d8).(1., 30, 30); |
| 160 | glPopMatrixcxx . . $ glPopMatrix(49f6e7a06ebc5aa8).( ); |
| 161 | glEnablecxx . . $ glEnable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 162 | } else if (typel == LTetscxx . . $ LTets.) { |
| 163 | pt1 = &mesh->tetracxx . . $ mesh#tetra.[k]; |
| 164 | pm = &sc->materialcxx . . $ scene#material.[refmatcxx . . $ refmat.]; |
| 165 | glColor4fvcxx . . $ glColor4fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 166 | |
| 167 | for (j = 0; j < 6; j++) { |
| 168 | m[j] = 0.; |
| 169 | } |
| 170 | |
| 171 | cx = cy = cz = 0.0; |
| 172 | |
| 173 | for (i = 0; i < 4; i++) { |
| 174 | if (mesh->nbbcxx . . $ mesh#nbb. == mesh->npcxx . . $ mesh#np.) |
| 175 | ps = &mesh->solcxx . . $ mesh#sol.[pt1->vcxx . . $ stetra#v.[i]]; |
| 176 | else if (mesh->nbbcxx . . $ mesh#nbb. == mesh->ntetcxx . . $ mesh#ntet.) |
| 177 | ps = &mesh->solcxx . . $ mesh#sol.[k]; |
| 178 | else |
| 179 | return; |
| 180 | |
| 181 | p0 = &mesh->pointcxx . . $ mesh#point.[pt1->vcxx . . $ stetra#v.[i]]; |
| 182 | cx += p0->ccxx . . $ spoint#c.[0]; |
| 183 | cy += p0->ccxx . . $ spoint#c.[1]; |
| 184 | cz += p0->ccxx . . $ spoint#c.[2]; |
| 185 | |
| 186 | for (j = 0; j < 6; j++) { |
| 187 | m[j] += ps->mcxx . . $ solu#m.[j]; |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | cx /= 4.; |
| 192 | cy /= 4.; |
| 193 | cz /= 4.; |
| 194 | |
| 195 | for (j = 0; j < 6; j++) { |
| 196 | m[j] /= 6.; |
| 197 | } |
| 198 | |
| 199 | if (!eigenvcxx . . $ eigenv(73317bed5d940d7e).(1, m, lambda, v)) return; |
| 200 | |
| 201 | lambda[0] = maxcxx . . $ `src/medit/medit.h:91:9`!(EPScxx . . $ `src/medit/medit.h:72:9`!, 0.5 / sqrt(lambda[0])); |
| 202 | lambda[1] = maxcxx . . $ `src/medit/medit.h:91:9`!(EPScxx . . $ `src/medit/medit.h:72:9`!, 0.5 / sqrt(lambda[1])); |
| 203 | lambda[2] = maxcxx . . $ `src/medit/medit.h:91:9`!(EPScxx . . $ `src/medit/medit.h:72:9`!, 0.5 / sqrt(lambda[2])); |
| 204 | |
| 205 | memcpycxx . . $ memcpy(cc817cb175f282d).(mat, IdMatrixcxx . . $ IdMatrix., 16 * sizeof(GLfloatcxx . . $ GLfloat#)); |
| 206 | |
| 207 | for (j = 0; j < 3; j++) { |
| 208 | for (l = 0; l < 3; l++) { |
| 209 | mat[j * 4 + l] = v[j][l]; |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | glDisablecxx . . $ glDisable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 214 | glPushMatrixcxx . . $ glPushMatrix(49f6e7a06ebc5aa8).( ); |
| 215 | glColor4fvcxx . . $ glColor4fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 216 | glTranslatefcxx . . $ glTranslatef(bd1040fe176e0786).(cx, cy, cz); |
| 217 | glMultMatrixfcxx . . $ glMultMatrixf(de58861cad56015a).(mat); |
| 218 | glScalefcxx . . $ glScalef(bd1040fe176e0786).(lambda[0], lambda[1], lambda[2]); |
| 219 | glutWireSpherecxx . . $ glutWireSphere(33fe0831888804d8).(1., 30, 30); |
| 220 | glPopMatrixcxx . . $ glPopMatrix(49f6e7a06ebc5aa8).( ); |
| 221 | glEnablecxx . . $ glEnable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 222 | } else { |
| 223 | return; |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | void glCirclecxx . . $ glCircle(9364e6e7bff7660).(float radius) { |
| 228 | float ang; |
| 229 | |
| 230 | glBegincxx . . $ glBegin(cb2f890c2fdad230).(GL_LINE_STRIPcxx . . $ `<external>/11565930711847777359/gl.h:159:9`!); |
| 231 | |
| 232 | for (ang = 0.0f; ang <= 2 * M_PIcxx . . $ `src/medit/medit.h:83:9`! + 0.2; ang += 0.2) { |
| 233 | float ux = radius * (float)sin((double)ang); |
| 234 | float uy = radius * (float)cos((double)ang); |
| 235 | glVertex2fcxx . . $ glVertex2f(5102ef758adc0ae7).(ux, uy); |
| 236 | } |
| 237 | |
| 238 | glEndcxx . . $ glEnd(49f6e7a06ebc5aa8).( ); |
| 239 | } |
| 240 | |
| 241 | void drawEllipsecxx . . $ drawEllipse(f8510699cb40afa3).(pScenecxx . . $ pScene# sc, pMeshcxx . . $ pMesh# mesh, int typel, int k) { |
| 242 | pSolutioncxx . . $ pSolution# ps; |
| 243 | double vp[2][2]; |
| 244 | |
| 245 | /* draw ellipse at vertex */ |
| 246 | if (typel == LPointcxx . . $ LPoint.) { |
| 247 | pMaterialcxx . . $ pMaterial# pm; |
| 248 | pPointcxx . . $ pPoint# p0; |
| 249 | double m[3], lambda[2], dd1, dd2; |
| 250 | float theta; |
| 251 | |
| 252 | ps = &mesh->solcxx . . $ mesh#sol.[k]; |
| 253 | p0 = &mesh->pointcxx . . $ mesh#point.[k]; |
| 254 | pm = &sc->materialcxx . . $ scene#material.[refmatcxx . . $ refmat.]; |
| 255 | |
| 256 | m[0] = ps->mcxx . . $ solu#m.[0]; |
| 257 | m[1] = ps->mcxx . . $ solu#m.[1]; |
| 258 | m[2] = ps->mcxx . . $ solu#m.[2]; |
| 259 | if (!eigen2cxx . . $ eigen2(5857e2113237355).(m, lambda, vp)) return; |
| 260 | |
| 261 | /* consider eigenvalues as sizes */ |
| 262 | dd1 = 1.0 / sqrt(fabs(lambda[0])); |
| 263 | dd2 = 1.0 / sqrt(fabs(lambda[1])); |
| 264 | |
| 265 | glDisablecxx . . $ glDisable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 266 | glPushMatrixcxx . . $ glPushMatrix(49f6e7a06ebc5aa8).( ); |
| 267 | glLineWidthcxx . . $ glLineWidth(9364e6e7bff7660).(1.0); |
| 268 | glBegincxx . . $ glBegin(cb2f890c2fdad230).(GL_LINEScxx . . $ `<external>/11565930711847777359/gl.h:157:9`!); |
| 269 | glColor3fvcxx . . $ glColor3fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 270 | glVertex3fcxx . . $ glVertex3f(bd1040fe176e0786).(p0->ccxx . . $ spoint#c.[0], p0->ccxx . . $ spoint#c.[1], 0.0); |
| 271 | glColor3fvcxx . . $ glColor3fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 272 | glVertex3fcxx . . $ glVertex3f(bd1040fe176e0786).(p0->ccxx . . $ spoint#c.[0] + dd1 * vp[0][0], p0->ccxx . . $ spoint#c.[1] + dd1 * vp[0][1], 0.0); |
| 273 | |
| 274 | glColor3fvcxx . . $ glColor3fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 275 | glVertex3fcxx . . $ glVertex3f(bd1040fe176e0786).(p0->ccxx . . $ spoint#c.[0], p0->ccxx . . $ spoint#c.[1], 0.0); |
| 276 | glColor3fvcxx . . $ glColor3fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 277 | glVertex3fcxx . . $ glVertex3f(bd1040fe176e0786).(p0->ccxx . . $ spoint#c.[0] + dd2 * vp[1][0], p0->ccxx . . $ spoint#c.[1] + dd2 * vp[1][1], 0.0); |
| 278 | glEndcxx . . $ glEnd(49f6e7a06ebc5aa8).( ); |
| 279 | |
| 280 | theta = atan2(vp[0][1], vp[0][0]) * RTODcxx . . $ `src/medit/medit.h:71:9`!; |
| 281 | glTranslatefcxx . . $ glTranslatef(bd1040fe176e0786).(p0->ccxx . . $ spoint#c.[0], p0->ccxx . . $ spoint#c.[1], 0.0); |
| 282 | glRotatefcxx . . $ glRotatef(7e9a355db6148521).(theta, 0.0, 0.0, 1.0); |
| 283 | glScaledcxx . . $ glScaled(98dd472ac7e5c3d4).(dd1, dd2, 0.0); |
| 284 | |
| 285 | glColor3fvcxx . . $ glColor3fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 286 | glCirclecxx . . $ glCircle(9364e6e7bff7660).(1.0); |
| 287 | glLineWidthcxx . . $ glLineWidth(9364e6e7bff7660).(1.0); |
| 288 | glPopMatrixcxx . . $ glPopMatrix(49f6e7a06ebc5aa8).( ); |
| 289 | glEnablecxx . . $ glEnable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 290 | |
| 291 | /* print out info */ |
| 292 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, " Eigenvectors :\n"); |
| 293 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, " vp1 : %f %f\n", vp[0][0], vp[0][1]); |
| 294 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, " vp2 : %f %f\n", vp[1][0], vp[1][1]); |
| 295 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, " Eigenvalues : %f %f\n", lambda[0], lambda[1]); |
| 296 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:158:9`!, " Sizes : %f %f\n", dd1, dd2); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | GLuintcxx . . $ GLuint# drawAllEllipsecxx . . $ drawAllEllipse(6d98adcc509ac451).(pScenecxx . . $ pScene# sc, pMeshcxx . . $ pMesh# mesh) { |
| 301 | GLuintcxx . . $ GLuint# dlist; |
| 302 | pSolutioncxx . . $ pSolution# ps; |
| 303 | pMaterialcxx . . $ pMaterial# pm; |
| 304 | pPointcxx . . $ pPoint# p0; |
| 305 | double m[3], vp[2][2], lambda[2], dd1, dd2; |
| 306 | float theta; |
| 307 | int k, ref; |
| 308 | |
| 309 | dlist = glGenListscxx . . $ glGenLists(46cc46841198e427).(1); |
| 310 | glNewListcxx . . $ glNewList(b4d55b1286ff73e8).(dlist, GL_COMPILEcxx . . $ `<external>/11565930711847777359/gl.h:252:9`!); |
| 311 | if (glGetErrorcxx . . $ glGetError(db52760e79bf9054).( )) return (0); |
| 312 | |
| 313 | /* draw ellipse at vertex */ |
| 314 | glDisablecxx . . $ glDisable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 315 | glLineWidthcxx . . $ glLineWidth(9364e6e7bff7660).(1.0); |
| 316 | |
| 317 | if (mesh->typagecxx . . $ mesh#typage. == 1) { |
| 318 | for (k = 1; k <= mesh->necxx . . $ mesh#ne.; k++) { |
| 319 | pTrianglecxx . . $ pTriangle# pt; |
| 320 | float cx, cy; |
| 321 | int i; |
| 322 | |
| 323 | ps = &mesh->solcxx . . $ mesh#sol.[k]; |
| 324 | pt = &mesh->triacxx . . $ mesh#tria.[k]; |
| 325 | if (!pt->vcxx . . $ striangle#v.[0]) continue; |
| 326 | |
| 327 | ref = matRef(sc, pt->refcxx . . $ striangle#ref.); |
| 328 | pm = &sc->materialcxx . . $ scene#material.[ref]; |
| 329 | if (pm->flagcxx . . $ material#flag.) continue; |
| 330 | |
| 331 | cx = cy = 0.0; |
| 332 | |
| 333 | for (i = 0; i < 3; i++) { |
| 334 | p0 = &mesh->pointcxx . . $ mesh#point.[pt->vcxx . . $ striangle#v.[i]]; |
| 335 | cx += p0->ccxx . . $ spoint#c.[0]; |
| 336 | cy += p0->ccxx . . $ spoint#c.[1]; |
| 337 | } |
| 338 | |
| 339 | cx *= 1. / 3.; |
| 340 | cy *= 1. / 3.; |
| 341 | |
| 342 | m[0] = ps->mcxx . . $ solu#m.[0]; |
| 343 | m[1] = ps->mcxx . . $ solu#m.[1]; |
| 344 | m[2] = ps->mcxx . . $ solu#m.[2]; |
| 345 | if (!eigen2cxx . . $ eigen2(5857e2113237355).(m, lambda, vp)) return (0); |
| 346 | |
| 347 | /* consider eigenvalues as sizes */ |
| 348 | dd1 = 1.0 / sqrt(fabs(lambda[0])); |
| 349 | dd2 = 1.0 / sqrt(fabs(lambda[1])); |
| 350 | |
| 351 | glPushMatrixcxx . . $ glPushMatrix(49f6e7a06ebc5aa8).( ); |
| 352 | theta = atan2(vp[0][1], vp[0][0]) * RTODcxx . . $ `src/medit/medit.h:71:9`!; |
| 353 | glTranslatefcxx . . $ glTranslatef(bd1040fe176e0786).(cx, cy, 0.0); |
| 354 | glRotatefcxx . . $ glRotatef(7e9a355db6148521).(theta, 0.0, 0.0, 1.0); |
| 355 | glScaledcxx . . $ glScaled(98dd472ac7e5c3d4).(dd1, dd2, 0.0); |
| 356 | glColor3fvcxx . . $ glColor3fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 357 | glCirclecxx . . $ glCircle(9364e6e7bff7660).(1.0); |
| 358 | glPopMatrixcxx . . $ glPopMatrix(49f6e7a06ebc5aa8).( ); |
| 359 | } |
| 360 | } else { |
| 361 | for (k = 1; k <= mesh->npcxx . . $ mesh#np.; k++) { |
| 362 | ps = &mesh->solcxx . . $ mesh#sol.[k]; |
| 363 | p0 = &mesh->pointcxx . . $ mesh#point.[k]; |
| 364 | |
| 365 | ref = matRef(sc, p0->refcxx . . $ spoint#ref.); |
| 366 | pm = &sc->materialcxx . . $ scene#material.[ref]; |
| 367 | if (pm->flagcxx . . $ material#flag.) continue; |
| 368 | |
| 369 | m[0] = ps->mcxx . . $ solu#m.[0]; |
| 370 | m[1] = ps->mcxx . . $ solu#m.[1]; |
| 371 | m[2] = ps->mcxx . . $ solu#m.[2]; |
| 372 | if (!eigen2cxx . . $ eigen2(5857e2113237355).(m, lambda, vp)) return (0); |
| 373 | |
| 374 | /* consider eigenvalues as sizes */ |
| 375 | dd1 = 1.0 / sqrt(fabs(lambda[0])); |
| 376 | dd2 = 1.0 / sqrt(fabs(lambda[1])); |
| 377 | |
| 378 | glPushMatrixcxx . . $ glPushMatrix(49f6e7a06ebc5aa8).( ); |
| 379 | theta = atan2(vp[0][1], vp[0][0]) * RTODcxx . . $ `src/medit/medit.h:71:9`!; |
| 380 | glTranslatefcxx . . $ glTranslatef(bd1040fe176e0786).(p0->ccxx . . $ spoint#c.[0], p0->ccxx . . $ spoint#c.[1], 0.0); |
| 381 | glRotatefcxx . . $ glRotatef(7e9a355db6148521).(theta, 0.0, 0.0, 1.0); |
| 382 | glScaledcxx . . $ glScaled(98dd472ac7e5c3d4).(dd1, dd2, 0.0); |
| 383 | glColor3fvcxx . . $ glColor3fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 384 | glCirclecxx . . $ glCircle(9364e6e7bff7660).(1.0); |
| 385 | glPopMatrixcxx . . $ glPopMatrix(49f6e7a06ebc5aa8).( ); |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | glEnablecxx . . $ glEnable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 390 | |
| 391 | glEndListcxx . . $ glEndList(49f6e7a06ebc5aa8).( ); |
| 392 | return (dlist); |
| 393 | } |
| 394 | |
| 395 | void circumSpherecxx . . $ circumSphere(f8510699cb40afa3).(pScenecxx . . $ pScene# sc, pMeshcxx . . $ pMesh# mesh, int typel, int k) { |
| 396 | pMaterialcxx . . $ pMaterial# pm; |
| 397 | double c[3], rad; |
| 398 | |
| 399 | cenrad(mesh, k, c, &rad); |
| 400 | rad = sqrt(rad); |
| 401 | pm = &sc->materialcxx . . $ scene#material.[refmatcxx . . $ refmat.]; |
| 402 | |
| 403 | glDisablecxx . . $ glDisable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 404 | glPushMatrixcxx . . $ glPushMatrix(49f6e7a06ebc5aa8).( ); |
| 405 | glColor4fvcxx . . $ glColor4fv(de58861cad56015a).(pm->difcxx . . $ material#dif.); |
| 406 | glTranslatedcxx . . $ glTranslated(98dd472ac7e5c3d4).(c[0], c[1], c[2]); |
| 407 | glScalefcxx . . $ glScalef(bd1040fe176e0786).(rad, rad, rad); |
| 408 | glutWireSpherecxx . . $ glutWireSphere(33fe0831888804d8).(1., 30, 30); |
| 409 | glPopMatrixcxx . . $ glPopMatrix(49f6e7a06ebc5aa8).( ); |
| 410 | glEnablecxx . . $ glEnable(cb2f890c2fdad230).(GL_LIGHTINGcxx . . $ `<external>/11565930711847777359/gl.h:276:9`!); |
| 411 | } |
| 412 | |
| 413 | #ifdef __cplusplus |
| 414 | } |
| 415 | #endif |