diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp index 6ed3106c41ee0d0d5ec923139a454fd23b26a65a..bc676d1bb3742b3915c24eea9eddbe50998ff649 100644 --- a/Graphics/Entity.cpp +++ b/Graphics/Entity.cpp @@ -1,4 +1,4 @@ -// $Id: Entity.cpp,v 1.32 2004-03-01 23:43:53 geuzaine Exp $ +// $Id: Entity.cpp,v 1.33 2004-04-13 18:47:32 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -88,8 +88,7 @@ void Draw_Cylinder(double width, double *x, double *y, double *z, int light) prodve(zdir, vdir, axis); norme(axis); prosca(zdir, vdir, &cosphi); - phi = 180. * acos(cosphi) / M_PI; - + phi = 180. * myacos(cosphi) / M_PI; glTranslatef(x[0], y[0], z[0]); glRotatef(phi, axis[0], axis[1], axis[2]); gluCylinder(qua, radius, radius, length, CTX.quadric_subdivisions, 1); @@ -352,7 +351,7 @@ void Draw_3DArrow(double relHeadRadius, double relStemLength, double relStemRadi prodve(zdir, vdir, axis); norme(axis); prosca(zdir, vdir, &cosphi); - phi = 180. * acos(cosphi) / M_PI; + phi = 180. * myacos(cosphi) / M_PI; glTranslatef(x, y, z); glRotatef(phi, axis[0], axis[1], axis[2]); diff --git a/Mesh/Utils.cpp b/Mesh/Utils.cpp index 2fa741c5bbde7ae3c8018866480cf79545101598..a3de1e82b6c32bd195e24c318400166b8dc68655 100644 --- a/Mesh/Utils.cpp +++ b/Mesh/Utils.cpp @@ -1,4 +1,4 @@ -// $Id: Utils.cpp,v 1.23 2004-03-28 01:16:50 geuzaine Exp $ +// $Id: Utils.cpp,v 1.24 2004-04-13 18:49:58 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -615,7 +615,7 @@ double angle_3pts(Vertex * a, Vertex * b, Vertex * c) prosca = ((a->Pos.X - b->Pos.X) * (c->Pos.X - b->Pos.X) + (a->Pos.Y - b->Pos.Y) * (c->Pos.Y - b->Pos.Y)) / L; - angle = acos(prosca) * 180. / Pi; + angle = myacos(prosca) * 180. / Pi; return (angle); } diff --git a/Numeric/Numeric.cpp b/Numeric/Numeric.cpp index 29fb6e0251b7476d7d7f627cb75030ae1d876e3f..d18dd6bfc888cf06a4270235a37a0a267c25a4ef 100644 --- a/Numeric/Numeric.cpp +++ b/Numeric/Numeric.cpp @@ -1,4 +1,4 @@ -// $Id: Numeric.cpp,v 1.11 2004-02-07 01:40:22 geuzaine Exp $ +// $Id: Numeric.cpp,v 1.12 2004-04-13 18:47:32 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -84,6 +84,16 @@ double myasin(double a) return asin(a); } +double myacos(double a) +{ + if(a <= -1.) + return Pi; + else if(a >= 1.) + return 0.; + else + return acos(a); +} + void prodve(double a[3], double b[3], double c[3]) { c[2] = a[0] * b[1] - a[1] * b[0]; diff --git a/Numeric/Numeric.h b/Numeric/Numeric.h index ef12e2b4ae7cb581893e236e70aa72eea33d6388..52d5270ab713eb7728e29ba9308b0c10172374eb 100644 --- a/Numeric/Numeric.h +++ b/Numeric/Numeric.h @@ -56,23 +56,23 @@ int check_gsl(); -double myatan2 (double a, double b); -double myasin (double a); -void prodve (double a[3], double b[3], double c[3]); -void prosca (double a[3], double b[3], double *c); -void norme (double a[3]); -int sys2x2 (double mat[2][2], double b[2], double res[2]); -int sys3x3 (double mat[3][3], double b[3], double res[3], double *det); -int sys3x3_with_tol (double mat[3][3], double b[3], double res[3], double *det); -int det3x3 (double mat[3][3], double *det); -int inv3x3 (double mat[3][3], double inv[3][3], double *det); -double angle_02pi (double A3); +double myatan2(double a, double b); +double myasin(double a); +double myacos(double a); +void prodve(double a[3], double b[3], double c[3]); +void prosca(double a[3], double b[3], double *c); +void norme(double a[3]); +int sys2x2(double mat[2][2], double b[2], double res[2]); +int sys3x3(double mat[3][3], double b[3], double res[3], double *det); +int sys3x3_with_tol(double mat[3][3], double b[3], double res[3], double *det); +int det3x3(double mat[3][3], double *det); +int inv3x3(double mat[3][3], double inv[3][3], double *det); +double angle_02pi(double A3); double InterpolateIso(double *X, double *Y, double *Z, double *Val, double V, int I1, int I2, double *XI, double *YI ,double *ZI); -void gradSimplex (double *x, double *y, double *z, double *v, double *grad); - +void gradSimplex(double *x, double *y, double *z, double *v, double *grad); /* Numerical routines implemented using either Numerical Recipes or the GSL */