57 double ps1,ps2,abx,aby,abz,acx,acy,acz,dd,rap,anisurf;
58 double n[3],pv[3],l[3],*ncomp,*a,*b,*c;
82 pv[0] = aby*acz - abz*acy;
83 pv[1] = abz*acx - abx*acz;
84 pv[2] = abx*acy - aby*acx;
86 dd = pv[0]*pv[0] + pv[1]*pv[1] + pv[2]*pv[2];
93 memcpy(n,&pa->
n[0],3*
sizeof(
double));
94 ps1 = n[0]*pv[0]+n[1]*pv[1]+n[2]*pv[2];
98 memcpy(n,&pb->
n[0],3*
sizeof(
double));
99 ps1 = n[0]*pv[0]+n[1]*pv[1]+n[2]*pv[2];
103 memcpy(n,&pc->
n[0],3*
sizeof(
double));
104 ps1 = n[0]*pv[0]+n[1]*pv[1]+n[2]*pv[2];
111 ps1 = n[0]*pv[0]+n[1]*pv[1]+n[2]*pv[2];
116 ps2 = ncomp[0]*pv[0]+ncomp[1]*pv[1]+ncomp[2]*pv[2];
118 if ( fabs(1.0-fabs(ps1)) > fabs(1.0-fabs(ps2)) ) {
119 memcpy(n,ncomp,3*
sizeof(
double));
126 if ( ps1 < 0.0 )
return -1.0;
129 if ( anisurf == 0.0 )
return -1.0;
135 rap = l[0]*l[0] + l[1]*l[1] + l[2]*l[2];
137 return anisurf / rap;
144 double *a,*b,*c,cal,abx,aby,abz,acx,acy,acz,bcx,bcy,bcz,rap;
145 double n[3],*ncomp,pv[3],ps1,ps2,sqcal,invsqcal;
172 pv[0] = aby*acz - abz*acy;
173 pv[1] = abz*acx - abx*acz;
174 pv[2] = abx*acy - aby*acx;
176 cal = pv[0]*pv[0] + pv[1]*pv[1] + pv[2]*pv[2];
180 invsqcal = 1.0 / sqcal;
183 memcpy(n,&pa->
n[0],3*
sizeof(
double));
184 ps1 = n[0]*pv[0]+n[1]*pv[1]+n[2]*pv[2];
188 memcpy(n,&pb->
n[0],3*
sizeof(
double));
189 ps1 = n[0]*pv[0]+n[1]*pv[1]+n[2]*pv[2];
193 memcpy(n,&pc->
n[0],3*
sizeof(
double));
194 ps1 = n[0]*pv[0]+n[1]*pv[1]+n[2]*pv[2];
199 ps1 = n[0]*pv[0]+n[1]*pv[1]+n[2]*pv[2];
204 ps2 = ncomp[0]*pv[0]+ncomp[1]*pv[1]+ncomp[2]*pv[2];
206 if ( fabs(1.0-fabs(ps1)) > fabs(1.0-fabs(ps2)) ) {
207 memcpy(n,ncomp,3*
sizeof(
double));
214 if ( ps1 < 0.0 )
return -1.0;
217 rap = abx*abx + aby*aby + abz*abz;
218 rap += acx*acx + acy*acy + acz*acz;
219 rap += bcx*bcx + bcy*bcy + bcz*bcz;
221 return sqrt(cal) / rap;
235 o[0] = dd * (p0->
c[0] + p1->
c[0] + p2->
c[0]);
236 o[1] = dd * (p0->
c[1] + p1->
c[1] + p2->
c[1]);
237 o[2] = dd * (p0->
c[2] + p1->
c[2] + p2->
c[2]);
239 rr = sqrt((p0->
c[0]-o[0])*(p0->
c[0]-o[0]) + (p0->
c[1]-o[1])*(p0->
c[1]-o[1]) \
240 + (p0->
c[2]-o[2])*(p0->
c[2]-o[2]));
242 r = sqrt((p1->
c[0]-o[0])*(p1->
c[0]-o[0]) + (p1->
c[1]-o[1])*(p1->
c[1]-o[1]) \
243 + (p1->
c[2]-o[2])*(p1->
c[2]-o[2]));
246 r = sqrt((p2->
c[0]-o[0])*(p2->
c[0]-o[0]) + (p2->
c[1]-o[1])*(p2->
c[1]-o[1]) \
247 + (p2->
c[2]-o[2])*(p2->
c[2]-o[2]));
256 di = (p1->
c[0]-p0->
c[0])*(p1->
c[0]-p0->
c[0])
257 + (p1->
c[1]-p0->
c[1])*(p1->
c[1]-p0->
c[1])
258 + (p1->
c[2]-p0->
c[2])*(p1->
c[2]-p0->
c[2]);
260 dd = (p2->
c[0]-p0->
c[0])*(p2->
c[0]-p0->
c[0])
261 + (p2->
c[1]-p0->
c[1])*(p2->
c[1]-p0->
c[1])
262 + (p2->
c[2]-p0->
c[2])*(p2->
c[2]-p0->
c[2]);
265 dd = (p2->
c[0]-p1->
c[0])*(p2->
c[0]-p1->
c[0])
266 + (p2->
c[1]-p1->
c[1])*(p2->
c[1]-p1->
c[1])
267 + (p2->
c[2]-p1->
c[2])*(p2->
c[2]-p1->
c[2]);
286 double len,avlen,lmin,lmax;
287 MMG5_int ned,hl[9],nullEdge;
288 MMG5_int k,np,nq,amin,bmin,amax,bmax;
290 static double bd[9]= {0.0, 0.3, 0.6, 0.7071, 0.9, 1.3, 1.4142, 2.0, 5.0};
292 memset(hl,0,9*
sizeof(MMG5_int));
297 amin = amax = bmin = bmax = 0;
300 if ( (!met) || (!met->
m) ) {
313 for(k=1; k<=
mesh->
nt; k++) {
315 if ( !
MG_EOK(pt) )
continue;
317 for(ia=0; ia<3; ia++) {
324 fprintf(stderr,
" ## Error: %s: function MMG5_hashEdge return 0\n",
332 for(k=1; k<=
mesh->
nt; k++) {
334 if ( !
MG_EOK(pt) )
continue;
336 for(ia=0; ia<3; ia++) {
345 if ( (!metRidTyp) && met->
m && met->
size>1 ) {
349 len = MMG5_lenSurfEdg(
mesh,met,np,nq,(pt->
tag[ia] &
MG_GEO));
372 if ( bd[i] <= len && len < bd[i+1] ) {
377 if( i == 8 ) hl[8]++;
384 amax, bmax, lmax, nullEdge, &bd[0], &hl[0],0);
401 double rap,rapmin,rapmax,rapavg,med;
402 MMG5_int his[5],k,iel,nex,ok;
410 for (k=0; k<5; k++) his[k] = 0;
413 for (k=1; k<=
mesh->
nt; k++) {
421 if ( met->
m && (met->
size == 6) ) {
428 if ( rap < rapmin ) {
432 if ( rap > 0.5 ) med++;
435 rapmax =
MG_MAX(rapmax,rap);
436 ir =
MG_MIN(4,(
int)(5.0*rap));
440 fprintf(stdout,
"\n -- MESH QUALITY %" MMG5_PRId
"\n",
mesh->
nt - nex);
441 fprintf(stdout,
" BEST %8.6f AVRG. %8.6f WRST. %8.6f (%" MMG5_PRId
")\n",
442 rapmax,rapavg / (
mesh->
nt-nex),rapmin,iel);
447 fprintf(stdout,
" HISTOGRAMM: %6.2f %% > 0.5\n",100.0*(med/(
float)(
mesh->
nt-nex)));
448 imax =
MG_MIN(4,(
int)(5.*rapmax));
449 for (i=imax; i>=(int)(5*rapmin); i--) {
450 fprintf(stdout,
" %5.1f < Q < %5.1f %7"MMG5_PRId
" %6.2f %%\n",
451 i/5.,i/5.+0.2,his[i],100.*(his[i]/(
float)(
mesh->
nt-nex)));
469 double rap,rapmin,rapmax,rapavg,med;
470 MMG5_int nex,his[5],k,iel,ok;
480 for (k=0; k<5; k++) his[k] = 0;
483 for (k=1; k<=
mesh->
nt; k++) {
493 if ( rap < rapmin ) {
497 if ( rap > 0.5 ) med++;
500 rapmax =
MG_MAX(rapmax,rap);
501 ir =
MG_MIN(4,(
int)(5.0*rap));
505 fprintf(stdout,
"\n -- MESH QUALITY %" MMG5_PRId
"\n",
mesh->
nt - nex);
506 fprintf(stdout,
" BEST %8.6f AVRG. %8.6f WRST. %8.6f (%" MMG5_PRId
")\n",
507 rapmax,rapavg / (
mesh->
nt-nex),rapmin,iel);
511 fprintf(stdout,
" HISTOGRAMM: %6.2f %% > 0.5\n",100.0*(med/(
float)(
mesh->
nt-nex)));
512 imax =
MG_MIN(4,(
int)(5.*rapmax));
513 for (i=imax; i>=(int)(5*rapmin); i--) {
514 fprintf(stdout,
" %5.1f < Q < %5.1f %7"MMG5_PRId
" %6.2f %%\n",
515 i/5.,i/5.+0.2,his[i],100.*(his[i]/(
float)(
mesh->
nt-nex)));
522#define COS145 -0.81915204428899
526 double h1,h2,h3,hmi,hma,ux,uy,uz,vx,vy,vz,wx,wy,wz,dd;
528 ux = p[1]->
c[0] - p[0]->
c[0];
529 uy = p[1]->
c[1] - p[0]->
c[1];
530 uz = p[1]->
c[2] - p[0]->
c[2];
531 h1 = ux*ux + uy*uy + uz*uz;
533 vx = p[2]->
c[0] - p[0]->
c[0];
534 vy = p[2]->
c[1] - p[0]->
c[1];
535 vz = p[2]->
c[2] - p[0]->
c[2];
536 h2 = vx*vx + vy*vy + vz*vz;
545 wx = p[2]->
c[0] - p[1]->
c[0];
546 wy = p[2]->
c[1] - p[1]->
c[1];
547 wz = p[2]->
c[2] - p[1]->
c[2];
548 h3 = wx*wx + wy*wy + wz*wz;
557 if ( hmi < 0.01 * hma )
return 1;
560 dd = (ux*vx + uy*vy + uz*vz) / sqrt(h1*h2);
565 dd = (vx*wx + vy*wy + vz*wz) / sqrt(h2*h3);
570 dd = -(ux*wx + uy*wy + uz*wz) / sqrt(h1*h3);
double MMG5_surftri_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
int MMG5_hashNew(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int hsiz, MMG5_int hmax)
MMG5_int MMG5_hashGet(MMG5_Hash *hash, MMG5_int a, MMG5_int b)
int MMG5_hashEdge(MMG5_pMesh mesh, MMG5_Hash *hash, MMG5_int a, MMG5_int b, MMG5_int k)
static double MMG5_lenSurfEdg33_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int np0, MMG5_int np1, int8_t isedg)
static double MMG5_lenSurfEdg_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int np0, MMG5_int np1, int8_t isedg)
int MMG5_minQualCheck(MMG5_int iel, double minqual, double alpha)
static const uint8_t MMG5_iprv2[3]
void MMG5_displayLengthHisto(MMG5_pMesh, MMG5_int, double *, MMG5_int, MMG5_int, double, MMG5_int, MMG5_int, double, int, double *, MMG5_int *, int8_t)
static const uint8_t MMG5_inxt2[6]
double MMG5_caltri_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria ptt)
double MMG5_caltri33_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_pTria pt)
#define MMG5_DEL_MEM(mesh, ptr)
int MMGS_inqua(MMG5_pMesh mesh, MMG5_pSol met)
double caleltsig_ani(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int iel)
int MMGS_prilen(MMG5_pMesh mesh, MMG5_pSol met, int metRidTyp)
int8_t typelt(MMG5_pPoint p[3], int8_t *ia)
int MMGS_outqua(MMG5_pMesh mesh, MMG5_pSol met)
double incircle(MMG5_pPoint p0, MMG5_pPoint p1, MMG5_pPoint p2, double *o)
double caleltsig_iso(MMG5_pMesh mesh, MMG5_pSol met, MMG5_int iel)
double diamelt(MMG5_pPoint p0, MMG5_pPoint p1, MMG5_pPoint p2)
Identic as MMG5_HGeom but use MMG5_hedge to store edges instead of MMG5_hgeom (memory economy).
Structure to store vertices of an MMG mesh.
Structure to store triangles of a MMG mesh.