Skip to content
Snippets Groups Projects
Commit 2bb06eeb authored by Gauthier Becker's avatar Gauthier Becker
Browse files

Default implementation of the inner radius in case LAPACK is not available....

Default implementation of the inner radius in case LAPACK is not available. Give the same value in case of a square 
parent e035d269
No related branches found
No related tags found
No related merge requests found
...@@ -294,6 +294,7 @@ double MQuadrangle::getOuterRadius() ...@@ -294,6 +294,7 @@ double MQuadrangle::getOuterRadius()
} }
double MQuadrangle::getInnerRadius() double MQuadrangle::getInnerRadius()
{ {
#if defined(HAVE_LAPACK)
// get the coordinates (x, y, z) of the 4 points defining the Quad // get the coordinates (x, y, z) of the 4 points defining the Quad
double x[4] = {_v[0]->x(), _v[1]->x(), _v[2]->x(), _v[3]->x()}; double x[4] = {_v[0]->x(), _v[1]->x(), _v[2]->x(), _v[3]->x()};
double y[4] = {_v[0]->y(), _v[1]->y(), _v[2]->y(), _v[3]->y()}; double y[4] = {_v[0]->y(), _v[1]->y(), _v[2]->y(), _v[3]->y()};
...@@ -364,4 +365,30 @@ double MQuadrangle::getInnerRadius() ...@@ -364,4 +365,30 @@ double MQuadrangle::getInnerRadius()
} }
} }
return R; return R;
#else // HAVE_LAPACK
// Default implementation. Not sure that the following give exactly
// the same value as the HAVE_LAPACK case !
// but same value for a square
// Mid-point of each edge of the quadrangle
SPoint3 A(_v[0]->x()+_v[1]->x(),_v[0]->y()+_v[1]->y(),_v[0]->z()+_v[1]->z());
SPoint3 B(_v[1]->x()+_v[2]->x(),_v[1]->y()+_v[2]->y(),_v[1]->z()+_v[2]->z());
SPoint3 C(_v[2]->x()+_v[3]->x(),_v[2]->y()+_v[3]->y(),_v[2]->z()+_v[3]->z());
SPoint3 D(_v[3]->x()+_v[0]->x(),_v[3]->y()+_v[0]->y(),_v[3]->z()+_v[0]->z());
A*=0.5; B*=0.5; C*=0.5; D*=0.5;
// compute the length of the side
double a = A.distance(B);
double b = B.distance(C);
double c = C.distance(D);
double d = D.distance(A);
// perimeter
double s = a+b+c+d;
double halfs = 0.5*s;
return 0.25*sqrt( (a*c+b*d)*(a*d+b*c)*(a*b+c*d)/
((halfs-a)*(halfs-b)*(halfs-c)*(halfs-d))
);
#endif // HAVE_LAPACK
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment