Hello mmg community,
I use mmg in a C++ software. So far, I had no problem using it for isotropic metric. I have began to implement the support of anisotropic metric, and I have an issue in the function called MMG5_cavity_ani
.
At some point, I end up with an Arithmetic Exception here crit += sqrt(dd/ray);
.
Inded, dd
is negative.
I have tried to cheat a little bit and ensure dd to be positive by computing ux
, uy
and uz
like that
ux = fabs(ppt->c[0] - c[0]);
uy = fabs(ppt->c[1] - c[1]);
uz =fabs( ppt->c[2] - c[2]);
dd = mj[0]*ux*ux + mj[3]*uy*uy + mj[5]*uz*uz + 2.0*(mj[1]*ux*uy + mj[2]*ux*uz + mj[4]*uy*uz);
But then, it was ray
that was negative. So I cheat again by doing ray=fabs(ray);
and now I have a correct results.
I have really hard trouble to debug. If I use mmg through command line, everything is going fine. I have checked multiple times if the metric was well specified usingthis page and it was.
I have tried with a “fake” anisotropic metric (with only 1 in the diagonal) and I still have an issue.
Do you have any tips on how to debug ? are ux, uz and uy supposed to be negative ?
Thanks !