#include <GeomAdaptor_HSurface.hxx>
#include <gp_Vec.hxx>
#include <Standard_RangeError.hxx>
+#include <Standard_NumericError.hxx>
IMPLEMENT_STANDARD_RTTIEXT(GeomEvaluator_OffsetSurface,GeomEvaluator_Surface)
}
}
+inline Standard_Boolean IsInfiniteCoord (const gp_Vec& theVec)
+{
+ return Precision::IsInfinite (theVec.X()) ||
+ Precision::IsInfinite (theVec.Y()) ||
+ Precision::IsInfinite (theVec.Z());
+}
+
+inline void CheckInfinite (const gp_Vec& theVecU, const gp_Vec& theVecV)
+{
+ if (IsInfiniteCoord (theVecU) || IsInfiniteCoord (theVecV))
+ {
+ throw Standard_NumericError ("GeomEvaluator_OffsetSurface: Evaluation of infinite parameters");
+ }
+}
+
} // end of anonymous namespace
GeomEvaluator_OffsetSurface::GeomEvaluator_OffsetSurface(
{
gp_Vec aD1U, aD1V;
BaseD1 (aU, aV, theValue, aD1U, aD1V);
+
+ CheckInfinite (aD1U, aD1V);
+
try
{
CalculateD0(aU, aV, theValue, aD1U, aD1V);
{
gp_Vec aD2U, aD2V, aD2UV;
BaseD2 (aU, aV, theValue, theD1U, theD1V, aD2U, aD2V, aD2UV);
+
+ CheckInfinite (theD1U, theD1V);
+
try
{
CalculateD1(aU, aV, theValue, theD1U, theD1V, aD2U, aD2V, aD2UV);
gp_Vec aD3U, aD3V, aD3UUV, aD3UVV;
BaseD3 (aU, aV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, aD3U, aD3V, aD3UUV, aD3UVV);
+
+ CheckInfinite (theD1U, theD1V);
+
try
{
CalculateD2 (aU, aV, theValue, theD1U, theD1V,
{
BaseD3 (aU, aV, theValue, theD1U, theD1V,
theD2U, theD2V, theD2UV, theD3U, theD3V, theD3UUV, theD3UVV);
+
+ CheckInfinite (theD1U, theD1V);
+
try
{
CalculateD3 (aU, aV, theValue, theD1U, theD1V,
gp_Pnt aP;
gp_Vec aD1U, aD1V;
BaseD1 (aU, aV, aP, aD1U, aD1V);
+
+ CheckInfinite (aD1U, aD1V);
+
try
{
return CalculateDN (aU, aV, theDerU, theDerV, aD1U, aD1V);
IMPLEMENT_STANDARD_RTTIEXT(ShapeAnalysis_Surface,Standard_Transient)
+namespace
+{
+ inline void RestrictBounds (double& theFirst, double& theLast)
+ {
+ Standard_Boolean isFInf = Precision::IsNegativeInfinite(theFirst);
+ Standard_Boolean isLInf = Precision::IsPositiveInfinite(theLast);
+ if (isFInf || isLInf)
+ {
+ if (isFInf && isLInf)
+ {
+ theFirst = -1000;
+ theLast = 1000;
+ }
+ else if (isFInf)
+ {
+ theFirst = theLast - 2000;
+ }
+ else
+ {
+ theLast = theFirst + 2000;
+ }
+ }
+ }
+
+ inline void RestrictBounds (double& theUf, double& theUl, double& theVf, double& theVl)
+ {
+ RestrictBounds (theUf, theUl);
+ RestrictBounds (theVf, theVl);
+ }
+}
+
//S4135
//S4135
//=======================================================================
Standard_Real uf, ul, vf, vl;
Bounds(uf, ul, vf, vl);//modified by rln on 12/11/97 mySurf-> is deleted
//mySurf->Bounds (uf,ul,vf,vl);
- if (Precision::IsInfinite(uf) || Precision::IsInfinite(ul))
- {
- myUDelt = 0.;
- }
- else
- {
- myUDelt = Abs(ul - uf) / 20;//modified by rln 11/11/97 instead of 10
- //because of the example when 10 was not enough
- }
+ RestrictBounds (uf, ul, vf, vl);
+ myUDelt = Abs(ul - uf) / 20;//modified by rln 11/11/97 instead of 10
+ //because of the example when 10 was not enough
if (mySurf->IsUClosed())
{
myUCloseVal = 0.;
Standard_Real uf, ul, vf, vl;
Bounds(uf, ul, vf, vl);//modified by rln on 12/11/97 mySurf-> is deleted
// mySurf->Bounds (uf,ul,vf,vl);
- if (Precision::IsInfinite(vf) || Precision::IsInfinite(vl))
- {
- myVDelt = 0.;
- }
- else
- {
- myVDelt = Abs(vl - vf) / 20;// 2; rln S4135
- //because of the example when 10 was not enough
- }
+ RestrictBounds (uf, ul, vf, vl);
+ myVDelt = Abs(vl - vf) / 20;// 2; rln S4135
+ //because of the example when 10 was not enough
if (mySurf->IsVClosed())
{
myVCloseVal = 0.;
ul = 500;
}
- if (Precision::IsInfinite(uf)) uf = -1000;
- if (Precision::IsInfinite(ul)) ul = 1000;
- if (Precision::IsInfinite(vf)) vf = -1000;
- if (Precision::IsInfinite(vl)) vl = 1000;
+ RestrictBounds (uf, ul, vf, vl);
//:30 by abv 2.12.97: speed optimization
// code is taken from GeomAPI_ProjectPointOnSurf
Cf = iso->FirstParameter();
Cl = iso->LastParameter();
- if (Precision::IsInfinite(Cf)) Cf = -1000;
- if (Precision::IsInfinite(Cl)) Cl = +1000;
+ RestrictBounds (Cf, Cl);
dist = ShapeAnalysis_Curve().Project(iso, P3d, preci, pntres, other, Cf, Cl, Standard_False);
if (dist < theMin) {
theMin = dist;
if (!iso.IsNull()) {
Cf = iso->FirstParameter();
Cl = iso->LastParameter();
- if (Precision::IsInfinite(Cf)) Cf = -1000;
- if (Precision::IsInfinite(Cl)) Cl = +1000;
+ RestrictBounds (Cf, Cl);
dist = ShapeAnalysis_Curve().Project(iso, P3d, preci, pntres, other, Cf, Cl, Standard_False);
if (dist < theMin) {
theMin = dist;
if (!iso.IsNull()) {
Cf = iso->FirstParameter();
Cl = iso->LastParameter();
- if (Precision::IsInfinite(Cf)) Cf = -1000;
- if (Precision::IsInfinite(Cl)) Cl = +1000;
+ RestrictBounds (Cf, Cl);
dist = ShapeAnalysis_Curve().Project(iso, P3d, preci, pntres, other, Cf, Cl, Standard_False);
if (dist < theMin) {
theMin = dist;
}
Cf = anIsoCurve.FirstParameter();
Cl = anIsoCurve.LastParameter();
- if (Precision::IsInfinite(Cf)) Cf = -1000;
- if (Precision::IsInfinite(Cl)) Cl = +1000;
+ RestrictBounds (Cf, Cl);
dist = ShapeAnalysis_Curve().Project(anIsoCurve, P3d, preci, pntres, other);
if (dist < theMin) {
theMin = dist;
}
Cf = anIsoCurve.FirstParameter();
Cl = anIsoCurve.LastParameter();
- if (Precision::IsInfinite(Cf)) Cf = -1000;
- if (Precision::IsInfinite(Cl)) Cl = +1000;
+ RestrictBounds (Cf, Cl);
dist = ShapeAnalysis_Curve().ProjectAct(anIsoCurve, P3d, preci, pntres, other);
if (dist < theMin) {
theMin = dist;