Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
d62617cb
Commit
d62617cb
authored
23 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
Fix precision problem with asin()
parent
682b13d1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Common/Numeric.cpp
+7
-1
7 additions, 1 deletion
Common/Numeric.cpp
Common/Numeric.h
+1
-0
1 addition, 0 deletions
Common/Numeric.h
Mesh/Create.cpp
+9
-6
9 additions, 6 deletions
Mesh/Create.cpp
with
17 additions
and
7 deletions
Common/Numeric.cpp
+
7
−
1
View file @
d62617cb
// $Id: Numeric.cpp,v 1.
3
200
1-12-03 08:41:43
geuzaine Exp $
// $Id: Numeric.cpp,v 1.
4
200
2-01-24 17:48:28
geuzaine Exp $
#include
"Gmsh.h"
#include
"Gmsh.h"
#include
"Numeric.h"
#include
"Numeric.h"
...
@@ -20,6 +20,12 @@ double myacos (double a){
...
@@ -20,6 +20,12 @@ double myacos (double a){
return
acos
(
a
);
return
acos
(
a
);
}
}
double
myasin
(
double
a
){
if
(
a
<=-
1.
)
return
-
Pi
/
2.
;
else
if
(
a
>=
1.
)
return
Pi
/
2.
;
else
return
asin
(
a
);
}
void
prodve
(
double
a
[
3
],
double
b
[
3
],
double
c
[
3
]){
void
prodve
(
double
a
[
3
],
double
b
[
3
],
double
c
[
3
]){
c
[
2
]
=
a
[
0
]
*
b
[
1
]
-
a
[
1
]
*
b
[
0
];
c
[
2
]
=
a
[
0
]
*
b
[
1
]
-
a
[
1
]
*
b
[
0
];
c
[
1
]
=
-
a
[
0
]
*
b
[
2
]
+
a
[
2
]
*
b
[
0
];
c
[
1
]
=
-
a
[
0
]
*
b
[
2
]
+
a
[
2
]
*
b
[
0
];
...
...
This diff is collapsed.
Click to expand it.
Common/Numeric.h
+
1
−
0
View file @
d62617cb
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
double
myatan2
(
double
a
,
double
b
);
double
myatan2
(
double
a
,
double
b
);
double
myacos
(
double
a
);
double
myacos
(
double
a
);
double
myasin
(
double
a
);
void
prodve
(
double
a
[
3
],
double
b
[
3
],
double
c
[
3
]);
void
prodve
(
double
a
[
3
],
double
b
[
3
],
double
c
[
3
]);
void
prosca
(
double
a
[
3
],
double
b
[
3
],
double
*
c
);
void
prosca
(
double
a
[
3
],
double
b
[
3
],
double
*
c
);
void
norme
(
double
a
[
3
]);
void
norme
(
double
a
[
3
]);
...
...
This diff is collapsed.
Click to expand it.
Mesh/Create.cpp
+
9
−
6
View file @
d62617cb
// $Id: Create.cpp,v 1.3
3
2002-01-2
3
1
6:28:00
geuzaine Exp $
// $Id: Create.cpp,v 1.3
4
2002-01-2
4
1
7:48:28
geuzaine Exp $
#include
"Gmsh.h"
#include
"Gmsh.h"
#include
"Numeric.h"
#include
"Numeric.h"
...
@@ -318,17 +318,20 @@ void End_Curve (Curve * c){
...
@@ -318,17 +318,20 @@ void End_Curve (Curve * c){
A1
=
A3
=
0.
;
A1
=
A3
=
0.
;
f1
=
f2
=
R
;
f1
=
f2
=
R
;
}
}
else
{
else
{
f1
=
sqrt
(
1.
/
sol
[
0
]);
f1
=
sqrt
(
1.
/
sol
[
0
]);
f2
=
sqrt
(
1.
/
sol
[
1
]);
f2
=
sqrt
(
1.
/
sol
[
1
]);
// myasin() permet de contourner les problemes de precision
// sur y1/f2 ou y3/f2, qui peuvent legerement etre hors de
// [-1,1]
if
(
x1
<
0
)
if
(
x1
<
0
)
A1
=
-
asin
(
y1
/
f2
)
+
A4
+
Pi
;
A1
=
-
my
asin
(
y1
/
f2
)
+
A4
+
Pi
;
else
else
A1
=
asin
(
y1
/
f2
)
+
A4
;
A1
=
my
asin
(
y1
/
f2
)
+
A4
;
if
(
x3
<
0
)
if
(
x3
<
0
)
A3
=
-
asin
(
y3
/
f2
)
+
A4
+
Pi
;
A3
=
-
my
asin
(
y3
/
f2
)
+
A4
+
Pi
;
else
else
A3
=
asin
(
y3
/
f2
)
+
A4
;
A3
=
my
asin
(
y3
/
f2
)
+
A4
;
}
}
}
}
else
{
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment