From e6865e83e7c5b4ef151c4eaa7d5f7b2cea5c6f59 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 13 Apr 2004 18:49:58 +0000
Subject: [PATCH] acos->myacos

---
 Graphics/Entity.cpp |  7 +++----
 Mesh/Utils.cpp      |  4 ++--
 Numeric/Numeric.cpp | 12 +++++++++++-
 Numeric/Numeric.h   | 26 +++++++++++++-------------
 4 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp
index 6ed3106c41..bc676d1bb3 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 2fa741c5bb..a3de1e82b6 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 29fb6e0251..d18dd6bfc8 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 ef12e2b4ae..52d5270ab7 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 */
-- 
GitLab