mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-16 10:54:53 +03:00
0028458: Some faces are missing when loading a specific CAD. This is a regression from OCCT 7.0 and Express Mesh 7.0.
Function ACos and ASin are modified to avoid exception when argument is +-(1. + Epsilon(1.)) because of "numerical noise"
This commit is contained in:
parent
f48cb55d33
commit
e525fd6ad2
@ -20,6 +20,8 @@
|
|||||||
#include <Standard_Stream.hxx>
|
#include <Standard_Stream.hxx>
|
||||||
#include <Standard_OStream.hxx>
|
#include <Standard_OStream.hxx>
|
||||||
|
|
||||||
|
static const Standard_Real ACosLimit = 1. + Epsilon(1.);
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Hascode : Computes a hascoding value for a given real
|
// Hascode : Computes a hascoding value for a given real
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
@ -43,10 +45,18 @@ Standard_Integer HashCode(const Standard_Real me, const Standard_Integer Upper)
|
|||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
Standard_Real ACos (const Standard_Real Value)
|
Standard_Real ACos (const Standard_Real Value)
|
||||||
{
|
{
|
||||||
if ( (Value < -1.) || (Value > 1.) ){
|
if ((Value < -ACosLimit) || (Value > ACosLimit)){
|
||||||
throw Standard_RangeError();
|
throw Standard_RangeError();
|
||||||
}
|
}
|
||||||
return acos(Value);
|
else if (Value > 1.)
|
||||||
|
{
|
||||||
|
return 0.; //acos(1.)
|
||||||
|
}
|
||||||
|
else if (Value < -1.)
|
||||||
|
{
|
||||||
|
return M_PI; //acos(-1.)
|
||||||
|
}
|
||||||
|
return acos(Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
@ -93,10 +103,18 @@ Standard_Real ACosApprox (const Standard_Real Value)
|
|||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
Standard_Real ASin (const Standard_Real Value)
|
Standard_Real ASin (const Standard_Real Value)
|
||||||
{
|
{
|
||||||
if ( Value < -1 || Value > 1 ){
|
if ((Value < -ACosLimit) || (Value > ACosLimit)){
|
||||||
throw Standard_RangeError();
|
throw Standard_RangeError();
|
||||||
}
|
}
|
||||||
return asin(Value);
|
else if (Value > 1.)
|
||||||
|
{
|
||||||
|
return M_PI_2; //asin(1.)
|
||||||
|
}
|
||||||
|
else if (Value < -1.)
|
||||||
|
{
|
||||||
|
return -M_PI_2; //asin(-1.)
|
||||||
|
}
|
||||||
|
return asin(Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user