1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00

0024211: Definition of Basic Runtime Check parameter causes regression in debug mode

Out of ChoixRef array boundaries.
Uninitialized variable in IntCurve_IntPolyPolyGen::findIntersect(...) function.
Handling of infinity numbers in sprops command is added.
test (CPU-limit)
This commit is contained in:
nbv 2013-10-04 18:26:23 +04:00 committed by bugmaster
parent 1c9cffdb4b
commit c63628e845
4 changed files with 741 additions and 433 deletions

View File

@ -102,6 +102,93 @@ static HMath_Vector IxyU = new math_Vector(1,SM,0.0);
static HMath_Vector IxzU = new math_Vector(1,SM,0.0); static HMath_Vector IxzU = new math_Vector(1,SM,0.0);
static HMath_Vector IyzU = new math_Vector(1,SM,0.0); static HMath_Vector IyzU = new math_Vector(1,SM,0.0);
static inline Standard_Real MultiplicationInf(Standard_Real theMA, Standard_Real theMB)
{
if((theMA == 0.0) || (theMB == 0.0)) //strictly zerro (without any tolerances)
return 0.0;
if(Precision::IsPositiveInfinite(theMA))
{
if(theMB < 0.0)
return -Precision::Infinite();
else
return Precision::Infinite();
}
if(Precision::IsPositiveInfinite(theMB))
{
if(theMA < 0.0)
return -Precision::Infinite();
else
return Precision::Infinite();
}
if(Precision::IsNegativeInfinite(theMA))
{
if(theMB < 0.0)
return +Precision::Infinite();
else
return -Precision::Infinite();
}
if(Precision::IsNegativeInfinite(theMB))
{
if(theMA < 0.0)
return +Precision::Infinite();
else
return -Precision::Infinite();
}
return (theMA * theMB);
}
static inline Standard_Real AdditionInf(Standard_Real theMA, Standard_Real theMB)
{
if(Precision::IsPositiveInfinite(theMA))
{
if(Precision::IsNegativeInfinite(theMB))
return 0.0;
else
return Precision::Infinite();
}
if(Precision::IsPositiveInfinite(theMB))
{
if(Precision::IsNegativeInfinite(theMA))
return 0.0;
else
return Precision::Infinite();
}
if(Precision::IsNegativeInfinite(theMA))
{
if(Precision::IsPositiveInfinite(theMB))
return 0.0;
else
return -Precision::Infinite();
}
if(Precision::IsNegativeInfinite(theMB))
{
if(Precision::IsPositiveInfinite(theMA))
return 0.0;
else
return -Precision::Infinite();
}
return (theMA + theMB);
}
static inline Standard_Real Multiplication(Standard_Real theMA, Standard_Real theMB)
{
return (theMA * theMB);
}
static inline Standard_Real Addition(Standard_Real theMA, Standard_Real theMB)
{
return (theMA + theMB);
}
static Standard_Integer FillIntervalBounds(Standard_Real A, static Standard_Integer FillIntervalBounds(Standard_Real A,
Standard_Real B, Standard_Real B,
const TColStd_Array1OfReal& Knots, const TColStd_Array1OfReal& Knots,
@ -129,7 +216,7 @@ static Standard_Integer FillIntervalBounds(Standard_Real A,
} }
static inline Standard_Integer MaxSubs(Standard_Integer n, Standard_Integer coeff = SUBS_POWER){ static inline Standard_Integer MaxSubs(Standard_Integer n, Standard_Integer coeff = SUBS_POWER){
// return n = IntegerLast()/coeff < n? IntegerLast(): n*coeff + 1; // return n = IntegerLast()/coeff < n? IntegerLast(): n*coeff + 1;
return Min((n * coeff + 1),SM); return Min((n * coeff + 1),SM);
} }
@ -194,6 +281,12 @@ static Standard_Real CCompute(Face& S,
const Standard_Boolean isErrorCalculation, const Standard_Boolean isErrorCalculation,
const Standard_Boolean isVerifyComputation) const Standard_Boolean isVerifyComputation)
{ {
Standard_Real (*FuncAdd)(Standard_Real, Standard_Real);
Standard_Real (*FuncMul)(Standard_Real, Standard_Real);
FuncAdd = Addition;
FuncMul = Multiplication;
Standard_Boolean isNaturalRestriction = S.NaturalRestriction(); Standard_Boolean isNaturalRestriction = S.NaturalRestriction();
Standard_Integer NumSubs = SUBS_POWER; Standard_Integer NumSubs = SUBS_POWER;
@ -206,7 +299,17 @@ static Standard_Real CCompute(Face& S,
//Face parametrization in U and V direction //Face parametrization in U and V direction
Standard_Real BV1, BV2, v; Standard_Real BV1, BV2, v;
Standard_Real BU1, BU2, u1, u2, um, ur, u; Standard_Real BU1, BU2, u1, u2, um, ur, u;
S.Bounds (BU1, BU2, BV1, BV2); u1 = BU1; S.Bounds (BU1, BU2, BV1, BV2);
u1 = BU1;
if(Precision::IsInfinite(BU1) || Precision::IsInfinite(BU2) ||
Precision::IsInfinite(BV1) || Precision::IsInfinite(BV2))
{
FuncAdd = AdditionInf;
FuncMul = MultiplicationInf;
}
//location point used to compute the inertia //location point used to compute the inertia
Standard_Real xloc, yloc, zloc; Standard_Real xloc, yloc, zloc;
loc.Coord (xloc, yloc, zloc); // use member of parent class loc.Coord (xloc, yloc, zloc); // use member of parent class
@ -242,16 +345,18 @@ static Standard_Real CCompute(Face& S,
TColStd_Array1OfReal UKnots(1,NbUSubs+1); TColStd_Array1OfReal UKnots(1,NbUSubs+1);
S.UKnots(UKnots); S.UKnots(UKnots);
while (isNaturalRestriction || D.More())
while (isNaturalRestriction || D.More()) { {
if(isNaturalRestriction){ if(isNaturalRestriction)
{
NbLGaussP[0] = Min(2*NbUGaussP[0],math::GaussPointsMax()); NbLGaussP[0] = Min(2*NbUGaussP[0],math::GaussPointsMax());
}else{ }
else
{
S.Load(D.Value()); ++iD; S.Load(D.Value()); ++iD;
NbLGaussP[0] = S.LIntOrder(EpsDim); NbLGaussP[0] = S.LIntOrder(EpsDim);
} }
NbLGaussP[1] = RealToInt(Ceiling(ERROR_ALGEBR_RATIO*NbLGaussP[0])); NbLGaussP[1] = RealToInt(Ceiling(ERROR_ALGEBR_RATIO*NbLGaussP[0]));
math::GaussPoints(NbLGaussP[0],LGaussP0); math::GaussWeights(NbLGaussP[0],LGaussW0); math::GaussPoints(NbLGaussP[0],LGaussP0); math::GaussWeights(NbLGaussP[0],LGaussW0);
math::GaussPoints(NbLGaussP[1],LGaussP1); math::GaussWeights(NbLGaussP[1],LGaussW1); math::GaussPoints(NbLGaussP[1],LGaussP1); math::GaussWeights(NbLGaussP[1],LGaussW1);
@ -259,28 +364,44 @@ static Standard_Real CCompute(Face& S,
NbLSubs = isNaturalRestriction? S.SVIntSubs(): S.LIntSubs(); NbLSubs = isNaturalRestriction? S.SVIntSubs(): S.LIntSubs();
TColStd_Array1OfReal LKnots(1,NbLSubs+1); TColStd_Array1OfReal LKnots(1,NbLSubs+1);
if(isNaturalRestriction){ if(isNaturalRestriction)
{
S.VKnots(LKnots); S.VKnots(LKnots);
l1 = BV1; l2 = BV2; l1 = BV1; l2 = BV2;
}else{ }
else
{
S.LKnots(LKnots); S.LKnots(LKnots);
l1 = S.FirstParameter(); l2 = S.LastParameter(); l1 = S.FirstParameter(); l2 = S.LastParameter();
} }
ErrorL = 0.0; ErrorL = 0.0;
kLEnd = 1; JL = 0; kLEnd = 1; JL = 0;
//OCC503(apo): if(Abs(l2-l1) < EPS_PARAM) continue; //OCC503(apo): if(Abs(l2-l1) < EPS_PARAM) continue;
if(Abs(l2-l1) > EPS_PARAM) { if(Abs(l2-l1) > EPS_PARAM)
{
iLSubEnd = LFillIntervalBounds(l1, l2, LKnots, NumSubs); iLSubEnd = LFillIntervalBounds(l1, l2, LKnots, NumSubs);
LMaxSubs = MaxSubs(iLSubEnd); LMaxSubs = MaxSubs(iLSubEnd);
if(LMaxSubs > DimL.Vector()->Upper()) LMaxSubs = DimL.Vector()->Upper(); if(LMaxSubs > DimL.Vector()->Upper())
LMaxSubs = DimL.Vector()->Upper();
DimL.Init(0.0,1,LMaxSubs); ErrL.Init(0.0,1,LMaxSubs); ErrUL.Init(0.0,1,LMaxSubs); DimL.Init(0.0,1,LMaxSubs); ErrL.Init(0.0,1,LMaxSubs); ErrUL.Init(0.0,1,LMaxSubs);
do{// while: L do{// while: L
if(++JL > iLSubEnd){ if(++JL > iLSubEnd)
LRange[0] = IL = ErrL->Max(); LRange[1] = JL; {
L1(JL) = (L1(IL) + L2(IL))/2.0; L2(JL) = L2(IL); L2(IL) = L1(JL); LRange[0] = IL = ErrL->Max();
}else LRange[0] = IL = JL; LRange[1] = JL;
L1(JL) = (L1(IL) + L2(IL))/2.0;
L2(JL) = L2(IL);
L2(IL) = L1(JL);
}
else
LRange[0] = IL = JL;
if(JL == LMaxSubs || Abs(L2(JL) - L1(JL)) < EPS_PARAM) if(JL == LMaxSubs || Abs(L2(JL) - L1(JL)) < EPS_PARAM)
if(kLEnd == 1){ if(kLEnd == 1)
{
DimL(JL) = ErrL(JL) = IxL(JL) = IyL(JL) = IzL(JL) = DimL(JL) = ErrL(JL) = IxL(JL) = IyL(JL) = IzL(JL) =
IxxL(JL) = IyyL(JL) = IzzL(JL) = IxyL(JL) = IxzL(JL) = IyzL(JL) = 0.0; IxxL(JL) = IyyL(JL) = IzzL(JL) = IxyL(JL) = IxzL(JL) = IyzL(JL) = 0.0;
}else{ }else{
@ -289,134 +410,252 @@ static Standard_Real CCompute(Face& S,
break; break;
} }
else else
for(kL=0; kL < kLEnd; kL++){ for(kL=0; kL < kLEnd; kL++)
{
iLS = LRange[kL]; iLS = LRange[kL];
lm = 0.5*(L2(iLS) + L1(iLS)); lm = 0.5*(L2(iLS) + L1(iLS));
lr = 0.5*(L2(iLS) - L1(iLS)); lr = 0.5*(L2(iLS) - L1(iLS));
CIx = CIy = CIz = CIxx = CIyy = CIzz = CIxy = CIxz = CIyz = 0.0; CIx = CIy = CIz = CIxx = CIyy = CIzz = CIxy = CIxz = CIyz = 0.0;
for(iGL=0; iGL < iGLEnd; iGL++){//
for(iGL=0; iGL < iGLEnd; iGL++)
{
CDim[iGL] = 0.0; CDim[iGL] = 0.0;
for(iL=1; iL<=NbLGaussP[iGL]; iL++){ for(iL=1; iL<=NbLGaussP[iGL]; iL++)
{
l = lm + lr*(*LGaussP[iGL])(iL); l = lm + lr*(*LGaussP[iGL])(iL);
if(isNaturalRestriction){ if(isNaturalRestriction)
{
v = l; u2 = BU2; Dul = (*LGaussW[iGL])(iL); v = l; u2 = BU2; Dul = (*LGaussW[iGL])(iL);
}else{ }
else
{
S.D12d (l, Puv, Vuv); S.D12d (l, Puv, Vuv);
Dul = Vuv.Y()*(*LGaussW[iGL])(iL); // Dul = Du / Dl Dul = Vuv.Y()*(*LGaussW[iGL])(iL); // Dul = Du / Dl
if(Abs(Dul) < EPS_PARAM) continue; if(Abs(Dul) < EPS_PARAM)
v = Puv.Y(); u2 = Puv.X(); continue;
v = Puv.Y();
u2 = Puv.X();
//Check on cause out off bounds of value current parameter //Check on cause out off bounds of value current parameter
if(v < BV1) v = BV1; else if(v > BV2) v = BV2; if(v < BV1)
if(u2 < BU1) u2 = BU1; else if(u2 > BU2) u2 = BU2; v = BV1;
else if(v > BV2)
v = BV2;
if(u2 < BU1)
u2 = BU1;
else if(u2 > BU2)
u2 = BU2;
} }
ErrUL(iLS) = 0.0; ErrUL(iLS) = 0.0;
kUEnd = 1; JU = 0; kUEnd = 1;
if(Abs(u2-u1) < EPS_PARAM) continue; JU = 0;
if(Abs(u2-u1) < EPS_PARAM)
continue;
iUSubEnd = UFillIntervalBounds(u1, u2, UKnots, NumSubs); iUSubEnd = UFillIntervalBounds(u1, u2, UKnots, NumSubs);
UMaxSubs = MaxSubs(iUSubEnd); UMaxSubs = MaxSubs(iUSubEnd);
if(UMaxSubs > DimU.Vector()->Upper()) UMaxSubs = DimU.Vector()->Upper(); if(UMaxSubs > DimU.Vector()->Upper())
UMaxSubs = DimU.Vector()->Upper();
DimU.Init(0.0,1,UMaxSubs); ErrU.Init(0.0,1,UMaxSubs); ErrorU = 0.0; DimU.Init(0.0,1,UMaxSubs); ErrU.Init(0.0,1,UMaxSubs); ErrorU = 0.0;
do{//while: U do{//while: U
if(++JU > iUSubEnd){ if(++JU > iUSubEnd)
URange[0] = IU = ErrU->Max(); URange[1] = JU; {
U1(JU) = (U1(IU)+U2(IU))/2.0; U2(JU) = U2(IU); U2(IU) = U1(JU); URange[0] = IU = ErrU->Max();
}else URange[0] = IU = JU; URange[1] = JU;
U1(JU) = (U1(IU)+U2(IU))/2.0;
U2(JU) = U2(IU);
U2(IU) = U1(JU);
}
else
URange[0] = IU = JU;
if(JU == UMaxSubs || Abs(U2(JU) - U1(JU)) < EPS_PARAM) if(JU == UMaxSubs || Abs(U2(JU) - U1(JU)) < EPS_PARAM)
if(kUEnd == 1){ if(kUEnd == 1)
{
DimU(JU) = ErrU(JU) = IxU(JU) = IyU(JU) = IzU(JU) = DimU(JU) = ErrU(JU) = IxU(JU) = IyU(JU) = IzU(JU) =
IxxU(JU) = IyyU(JU) = IzzU(JU) = IxyU(JU) = IxzU(JU) = IyzU(JU) = 0.0; IxxU(JU) = IyyU(JU) = IzzU(JU) = IxyU(JU) = IxzU(JU) = IyzU(JU) = 0.0;
}else{ }else
{
JU--; JU--;
EpsU = ErrorU; Eps = EpsU*Abs((u2-u1)*Dul)/0.1; EpsL = 0.9*Eps; EpsU = ErrorU; Eps = EpsU*Abs((u2-u1)*Dul)/0.1; EpsL = 0.9*Eps;
break; break;
} }
else else
for(kU=0; kU < kUEnd; kU++){ for(kU=0; kU < kUEnd; kU++)
{
iUS = URange[kU]; iUS = URange[kU];
um = 0.5*(U2(iUS) + U1(iUS)); um = 0.5*(U2(iUS) + U1(iUS));
ur = 0.5*(U2(iUS) - U1(iUS)); ur = 0.5*(U2(iUS) - U1(iUS));
LocIx = LocIy = LocIz = LocIxx = LocIyy = LocIzz = LocIxy = LocIxz = LocIyz = 0.0; LocIx = LocIy = LocIz = LocIxx = LocIyy = LocIzz = LocIxy = LocIxz = LocIyz = 0.0;
iGUEnd = iGLEnd - iGL; iGUEnd = iGLEnd - iGL;
for(iGU=0; iGU < iGUEnd; iGU++){// for(iGU=0; iGU < iGUEnd; iGU++)
{
LocDim[iGU] = 0.0; LocDim[iGU] = 0.0;
for(iU=1; iU<=NbUGaussP[iGU]; iU++){ for(iU=1; iU <= NbUGaussP[iGU]; iU++)
{
u = um + ur*(*UGaussP[iGU])(iU); u = um + ur*(*UGaussP[iGU])(iU);
S.Normal(u, v, Ps, VNor); S.Normal(u, v, Ps, VNor);
ds = VNor.Magnitude(); //Jacobien(x,y,z) -> (u,v)=||n|| ds = VNor.Magnitude(); //Jacobien(x,y,z) -> (u,v)=||n||
ds *= (*UGaussW[iGU])(iU); ds *= (*UGaussW[iGU])(iU);
LocDim[iGU] += ds; LocDim[iGU] += ds;
if(iGU > 0) continue;
if(iGU > 0)
continue;
Ps.Coord(x, y, z); Ps.Coord(x, y, z);
x -= xloc; y -= yloc; z -= zloc; x = FuncAdd(x, -xloc);
LocIx += x*ds; LocIy += y*ds; LocIz += z*ds; y = FuncAdd(y, -yloc);
LocIxy += x*y*ds; LocIyz += y*z*ds; LocIxz += x*z*ds; z = FuncAdd(z, -zloc);
x *= x; y *= y; z *= z;
LocIxx += (y+z)*ds; LocIyy += (x+z)*ds; LocIzz += (x+y)*ds; const Standard_Real XdS = FuncMul(x, ds);
const Standard_Real YdS = FuncMul(y, ds);
const Standard_Real ZdS = FuncMul(z, ds);
LocIx = FuncAdd(LocIx, XdS);
LocIy = FuncAdd(LocIy, YdS);
LocIz = FuncAdd(LocIz, ZdS);
LocIxy = FuncAdd(LocIxy, FuncMul(x, YdS));
LocIyz = FuncAdd(LocIyz, FuncMul(y, ZdS));
LocIxz = FuncAdd(LocIxz, FuncMul(x, ZdS));
x = Precision::IsInfinite(x) ? Precision::Infinite() : x*x;
y = Precision::IsInfinite(y) ? Precision::Infinite() : y*y;
z = Precision::IsInfinite(z) ? Precision::Infinite() : z*z;
LocIxx = FuncAdd(LocIxx, FuncAdd(YdS, ZdS));
LocIyy = FuncAdd(LocIyy, FuncAdd(XdS, ZdS));
LocIzz = FuncAdd(LocIzz, FuncAdd(XdS, YdS));
}//for: iU }//for: iU
}//for: iGU }//for: iGU
DimU(iUS) = LocDim[0]*ur;
if(iGL > 0) continue; DimU(iUS) = FuncMul(LocDim[0],ur);
ErrU(iUS) = Abs(LocDim[1]-LocDim[0])*ur; if(iGL > 0)
IxU(iUS) = LocIx*ur; IyU(iUS) = LocIy*ur; IzU(iUS) = LocIz*ur; continue;
IxxU(iUS) = LocIxx*ur; IyyU(iUS) = LocIyy*ur; IzzU(iUS) = LocIzz*ur;
IxyU(iUS) = LocIxy*ur; IxzU(iUS) = LocIxz*ur; IyzU(iUS) = LocIyz*ur; ErrU(iUS) = FuncMul(Abs(LocDim[1]-LocDim[0]), ur);
IxU(iUS) = FuncMul(LocIx, ur);
IyU(iUS) = FuncMul(LocIy, ur);
IzU(iUS) = FuncMul(LocIz, ur);
IxxU(iUS) = FuncMul(LocIxx, ur);
IyyU(iUS) = FuncMul(LocIyy, ur);
IzzU(iUS) = FuncMul(LocIzz, ur);
IxyU(iUS) = FuncMul(LocIxy, ur);
IxzU(iUS) = FuncMul(LocIxz, ur);
IyzU(iUS) = FuncMul(LocIyz, ur);
}//for: kU (iUS) }//for: kU (iUS)
if(JU == iUSubEnd) kUEnd = 2;
if(kUEnd == 2) ErrorU = ErrU(ErrU->Max()); if(JU == iUSubEnd)
kUEnd = 2;
if(kUEnd == 2)
ErrorU = ErrU(ErrU->Max());
}while((ErrorU - EpsU > 0.0 && EpsU != 0.0) || kUEnd == 1); }while((ErrorU - EpsU > 0.0 && EpsU != 0.0) || kUEnd == 1);
for(i=1; i<=JU; i++) CDim[iGL] += DimU(i)*Dul;
if(iGL > 0) continue; for(i=1; i<=JU; i++)
CDim[iGL] = FuncAdd(CDim[iGL], FuncMul(DimU(i), Dul));
if(iGL > 0)
continue;
ErrUL(iLS) = ErrorU*Abs((u2-u1)*Dul); ErrUL(iLS) = ErrorU*Abs((u2-u1)*Dul);
for(i=1; i<=JU; i++){ for(i=1; i<=JU; i++)
CIx += IxU(i)*Dul; CIy += IyU(i)*Dul; CIz += IzU(i)*Dul; {
CIxx += IxxU(i)*Dul; CIyy += IyyU(i)*Dul; CIzz += IzzU(i)*Dul; CIx = FuncAdd(CIx, FuncMul(IxU(i), Dul));
CIxy += IxyU(i)*Dul; CIxz += IxzU(i)*Dul; CIyz += IyzU(i)*Dul; CIy = FuncAdd(CIy, FuncMul(IyU(i), Dul));
CIz = FuncAdd(CIz, FuncMul(IzU(i), Dul));
CIxx = FuncAdd(CIxx, FuncMul(IxxU(i), Dul));
CIyy = FuncAdd(CIyy, FuncMul(IyyU(i), Dul));
CIzz = FuncAdd(CIzz, FuncMul(IzzU(i), Dul));
CIxy = FuncAdd(CIxy, FuncMul(IxyU(i), Dul));
CIxz = FuncAdd(CIxz, FuncMul(IxzU(i), Dul));
CIyz = FuncAdd(CIyz, FuncMul(IyzU(i), Dul));
} }
}//for: iL }//for: iL
}//for: iGL }//for: iGL
DimL(iLS) = CDim[0]*lr;
if(iGLEnd == 2) ErrL(iLS) = Abs(CDim[1]-CDim[0])*lr + ErrUL(iLS); DimL(iLS) = FuncMul(CDim[0], lr);
IxL(iLS) = CIx*lr; IyL(iLS) = CIy*lr; IzL(iLS) = CIz*lr; if(iGLEnd == 2)
IxxL(iLS) = CIxx*lr; IyyL(iLS) = CIyy*lr; IzzL(iLS) = CIzz*lr; ErrL(iLS) = FuncAdd(FuncMul(Abs(CDim[1]-CDim[0]),lr), ErrUL(iLS));
IxyL(iLS) = CIxy*lr; IxzL(iLS) = CIxz*lr; IyzL(iLS) = CIyz*lr;
IxL(iLS) = FuncMul(CIx, lr);
IyL(iLS) = FuncMul(CIy, lr);
IzL(iLS) = FuncMul(CIz, lr);
IxxL(iLS) = FuncMul(CIxx, lr);
IyyL(iLS) = FuncMul(CIyy, lr);
IzzL(iLS) = FuncMul(CIzz, lr);
IxyL(iLS) = FuncMul(CIxy, lr);
IxzL(iLS) = FuncMul(CIxz, lr);
IyzL(iLS) = FuncMul(CIyz, lr);
}//for: (kL)iLS }//for: (kL)iLS
// Calculate/correct epsilon of computation by current value of Dim // Calculate/correct epsilon of computation by current value of Dim
//That is need for not spend time for //That is need for not spend time for
if(JL == iLSubEnd){ if(JL == iLSubEnd)
{
kLEnd = 2; kLEnd = 2;
Standard_Real DDim = 0.0; Standard_Real DDim = 0.0;
for(i=1; i<=JL; i++) DDim += DimL(i); for(i=1; i<=JL; i++)
DDim += DimL(i);
DDim = Abs(DDim*EpsDim); DDim = Abs(DDim*EpsDim);
if(DDim > Eps) { if(DDim > Eps)
Eps = DDim; EpsL = 0.9*Eps; {
Eps = DDim;
EpsL = 0.9*Eps;
} }
} }
if(kLEnd == 2) ErrorL = ErrL(ErrL->Max());
if(kLEnd == 2)
ErrorL = ErrL(ErrL->Max());
}while((ErrorL - EpsL > 0.0 && isVerifyComputation) || kLEnd == 1); }while((ErrorL - EpsL > 0.0 && isVerifyComputation) || kLEnd == 1);
for(i=1; i<=JL; i++){
Dim += DimL(i); for(i=1; i<=JL; i++)
Ix += IxL(i); Iy += IyL(i); Iz += IzL(i); {
Ixx += IxxL(i); Iyy += IyyL(i); Izz += IzzL(i); Dim = FuncAdd(Dim, DimL(i));
Ixy += IxyL(i); Ixz += IxzL(i); Iyz += IyzL(i); Ix = FuncAdd(Ix, IxL(i));
Iy = FuncAdd(Iy, IyL(i));
Iz = FuncAdd(Iz, IzL(i));
Ixx = FuncAdd(Ixx, IxxL(i));
Iyy = FuncAdd(Iyy, IyyL(i));
Izz = FuncAdd(Izz, IzzL(i));
Ixy = FuncAdd(Ixy, IxyL(i));
Ixz = FuncAdd(Ixz, IxzL(i));
Iyz = FuncAdd(Iyz, IyzL(i));
} }
ErrorLMax = Max(ErrorLMax, ErrorL); ErrorLMax = Max(ErrorLMax, ErrorL);
} }
if(isNaturalRestriction) break;
if(isNaturalRestriction)
break;
D.Next(); D.Next();
} }
if(Abs(Dim) >= EPS_DIM){
Ix /= Dim; Iy /= Dim; Iz /= Dim; if(Abs(Dim) >= EPS_DIM)
{
Ix /= Dim;
Iy /= Dim;
Iz /= Dim;
g.SetCoord (Ix, Iy, Iz); g.SetCoord (Ix, Iy, Iz);
}else{ }
else
{
Dim =0.0; Dim =0.0;
g.SetCoord (0., 0.,0.); g.SetCoord (0., 0.,0.);
} }
inertia = gp_Mat (gp_XYZ (Ixx, -Ixy, -Ixz), inertia = gp_Mat (gp_XYZ (Ixx, -Ixy, -Ixz),
gp_XYZ (-Ixy, Iyy, -Iyz), gp_XYZ (-Ixy, Iyy, -Iyz),
gp_XYZ (-Ixz, -Iyz, Izz)); gp_XYZ (-Ixz, -Iyz, Izz));
if(iGLEnd == 2) Eps = Dim != 0.0? ErrorLMax/Abs(Dim): 0.0; if(iGLEnd == 2)
else Eps = EpsDim; Eps = Dim != 0.0? ErrorLMax/Abs(Dim): 0.0;
else
Eps = EpsDim;
return Eps; return Eps;
} }
@ -439,7 +678,14 @@ static Standard_Real Compute(Face& S, Domain& D, const gp_Pnt& loc, Standard_Rea
return CCompute(S,D,loc,Dim,g,inertia,EpsDim,isErrorCalculation,isVerifyComputation); return CCompute(S,D,loc,Dim,g,inertia,EpsDim,isErrorCalculation,isVerifyComputation);
} }
static void Compute(Face& S, Domain& D, const gp_Pnt& loc, Standard_Real& dim, gp_Pnt& g, gp_Mat& inertia){ static void Compute(Face& S, Domain& D, const gp_Pnt& loc, Standard_Real& dim, gp_Pnt& g, gp_Mat& inertia)
{
Standard_Real (*FuncAdd)(Standard_Real, Standard_Real);
Standard_Real (*FuncMul)(Standard_Real, Standard_Real);
FuncAdd = Addition;
FuncMul = Multiplication;
Standard_Real Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz; Standard_Real Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz;
dim = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0; dim = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0;
@ -464,6 +710,14 @@ static void Compute(Face& S, Domain& D, const gp_Pnt& loc, Standard_Real& dim, g
S.Bounds (u1, u2, v1, v2); S.Bounds (u1, u2, v1, v2);
if(Precision::IsInfinite(u1) || Precision::IsInfinite(u2) ||
Precision::IsInfinite(v1) || Precision::IsInfinite(v2))
{
FuncAdd = AdditionInf;
FuncMul = MultiplicationInf;
}
Standard_Integer NbUGaussgp_Pnts = Min(S.UIntegrationOrder (), Standard_Integer NbUGaussgp_Pnts = Min(S.UIntegrationOrder (),
math::GaussPointsMax()); math::GaussPointsMax());
Standard_Integer NbVGaussgp_Pnts = Min(S.VIntegrationOrder (), Standard_Integer NbVGaussgp_Pnts = Min(S.VIntegrationOrder (),
@ -517,51 +771,60 @@ static void Compute(Face& S, Domain& D, const gp_Pnt& loc, Standard_Real& dim, g
LocArea = LocIx = LocIy = LocIz = LocIxx = LocIyy = LocIzz = LocArea = LocIx = LocIy = LocIz = LocIxx = LocIyy = LocIzz =
LocIxy = LocIxz = LocIyz = 0.0; LocIxy = LocIxz = LocIyz = 0.0;
for (Standard_Integer j = 1; j <= NbGaussgp_Pnts; j++) { for (Standard_Integer j = 1; j <= NbGaussgp_Pnts; j++) {
u = um + ur * GaussSPV (j); u = FuncAdd(um, FuncMul(ur, GaussSPV (j)));
S.Normal (u, v, P, VNor); S.Normal (u, v, P, VNor);
ds = VNor.Magnitude(); //normal.Magnitude ds = VNor.Magnitude(); //normal.Magnitude
ds = ds * Dul * GaussSWV (j); ds = FuncMul(ds, Dul) * GaussSWV (j);
LocArea += ds; LocArea = FuncAdd(LocArea, ds);
P.Coord (x, y, z); P.Coord (x, y, z);
x -= xloc;
y -= yloc; x = FuncAdd(x, -xloc);
z -= zloc; y = FuncAdd(y, -yloc);
LocIx += x * ds; z = FuncAdd(z, -zloc);
LocIy += y * ds;
LocIz += z * ds; const Standard_Real XdS = FuncMul(x, ds);
LocIxy += x * y * ds; const Standard_Real YdS = FuncMul(y, ds);
LocIyz += y * z * ds; const Standard_Real ZdS = FuncMul(z, ds);
LocIxz += x * z * ds;
x *= x; LocIx = FuncAdd(LocIx, XdS);
y *= y; LocIy = FuncAdd(LocIy, YdS);
z *= z; LocIz = FuncAdd(LocIz, ZdS);
LocIxx += (y + z) * ds; LocIxy = FuncAdd(LocIxy, FuncMul(x, YdS));
LocIyy += (x + z) * ds; LocIyz = FuncAdd(LocIyz, FuncMul(y, ZdS));
LocIzz += (x + y) * ds; LocIxz = FuncAdd(LocIxz, FuncMul(x, ZdS));
x = Precision::IsInfinite(x) ? Precision::Infinite() : x*x;
y = Precision::IsInfinite(y) ? Precision::Infinite() : y*y;
z = Precision::IsInfinite(z) ? Precision::Infinite() : z*z;
LocIxx = FuncAdd(LocIxx, FuncAdd(YdS, ZdS));
LocIyy = FuncAdd(LocIyy, FuncAdd(XdS, ZdS));
LocIzz = FuncAdd(LocIzz, FuncAdd(XdS, YdS));
} }
CArea += LocArea * ur;
CIx += LocIx * ur; CArea = FuncAdd(CArea, FuncMul(LocArea, ur));
CIy += LocIy * ur; CIx = FuncAdd(CIx, FuncMul(LocIx, ur));
CIz += LocIz * ur; CIy = FuncAdd(CIy, FuncMul(LocIy, ur));
CIxx += LocIxx * ur; CIz = FuncAdd(CIz, FuncMul(LocIz, ur));
CIyy += LocIyy * ur; CIxx = FuncAdd(CIxx, FuncMul(LocIxx, ur));
CIzz += LocIzz * ur; CIyy = FuncAdd(CIyy, FuncMul(LocIyy, ur));
CIxy += LocIxy * ur; CIzz = FuncAdd(CIzz, FuncMul(LocIzz, ur));
CIxz += LocIxz * ur; CIxy = FuncAdd(CIxy, FuncMul(LocIxy, ur));
CIyz += LocIyz * ur; CIxz = FuncAdd(CIxz, FuncMul(LocIxz, ur));
CIyz = FuncAdd(CIyz, FuncMul(LocIyz, ur));
} }
dim += CArea * lr;
Ix += CIx * lr; dim = FuncAdd(dim, FuncMul(CArea, lr));
Iy += CIy * lr; Ix = FuncAdd(Ix, FuncMul(CIx, lr));
Iz += CIz * lr; Iy = FuncAdd(Iy, FuncMul(CIy, lr));
Ixx += CIxx * lr; Iz = FuncAdd(Iz, FuncMul(CIz, lr));
Iyy += CIyy * lr; Ixx = FuncAdd(Ixx, FuncMul(CIxx, lr));
Izz += CIzz * lr; Iyy = FuncAdd(Iyy, FuncMul(CIyy, lr));
Ixy += CIxy * lr; Izz = FuncAdd(Izz, FuncMul(CIzz, lr));
Ixz += CIxz * lr; Ixy = FuncAdd(Ixy, FuncMul(CIxy, lr));
Iyz += CIyz * lr; Ixz = FuncAdd(Iyz, FuncMul(CIxz, lr));
Iyz = FuncAdd(Ixz, FuncMul(CIyz, lr));
D.Next(); D.Next();
} }
if (Abs(dim) >= EPS_DIM) { if (Abs(dim) >= EPS_DIM) {
Ix /= dim; Ix /= dim;
Iy /= dim; Iy /= dim;
@ -572,19 +835,37 @@ static void Compute(Face& S, Domain& D, const gp_Pnt& loc, Standard_Real& dim, g
dim =0.; dim =0.;
g.SetCoord (0., 0.,0.); g.SetCoord (0., 0.,0.);
} }
inertia = gp_Mat (gp_XYZ (Ixx, -Ixy, -Ixz), inertia = gp_Mat (gp_XYZ (Ixx, -Ixy, -Ixz),
gp_XYZ (-Ixy, Iyy, -Iyz), gp_XYZ (-Ixy, Iyy, -Iyz),
gp_XYZ (-Ixz, -Iyz, Izz)); gp_XYZ (-Ixz, -Iyz, Izz));
} }
static void Compute(const Face& S,
const gp_Pnt& loc,
Standard_Real& dim,
gp_Pnt& g,
gp_Mat& inertia)
{
Standard_Real (*FuncAdd)(Standard_Real, Standard_Real);
Standard_Real (*FuncMul)(Standard_Real, Standard_Real);
FuncAdd = Addition;
FuncMul = Multiplication;
static void Compute(const Face& S, const gp_Pnt& loc, Standard_Real& dim, gp_Pnt& g, gp_Mat& inertia){
Standard_Real Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz; Standard_Real Ix, Iy, Iz, Ixx, Iyy, Izz, Ixy, Ixz, Iyz;
dim = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0; dim = Ix = Iy = Iz = Ixx = Iyy = Izz = Ixy = Ixz = Iyz = 0.0;
Standard_Real LowerU, UpperU, LowerV, UpperV; Standard_Real LowerU, UpperU, LowerV, UpperV;
S.Bounds (LowerU, UpperU, LowerV, UpperV); S.Bounds (LowerU, UpperU, LowerV, UpperV);
if(Precision::IsInfinite(LowerU) || Precision::IsInfinite(UpperU) ||
Precision::IsInfinite(LowerV) || Precision::IsInfinite(UpperV))
{
FuncAdd = AdditionInf;
FuncMul = MultiplicationInf;
}
Standard_Integer UOrder = Min(S.UIntegrationOrder (), Standard_Integer UOrder = Min(S.UIntegrationOrder (),
math::GaussPointsMax()); math::GaussPointsMax());
Standard_Integer VOrder = Min(S.VIntegrationOrder (), Standard_Integer VOrder = Min(S.VIntegrationOrder (),
@ -611,67 +892,80 @@ static void Compute(const Face& S, const gp_Pnt& loc, Standard_Real& dim, gp_Pnt
math::GaussWeights (VOrder,GaussWV); math::GaussWeights (VOrder,GaussWV);
// Calcul des integrales aux points de gauss : // Calcul des integrales aux points de gauss :
um = 0.5 * (UpperU + LowerU); um = 0.5 * FuncAdd(UpperU, LowerU);
vm = 0.5 * (UpperV + LowerV); vm = 0.5 * FuncAdd(UpperV, LowerV);
ur = 0.5 * (UpperU - LowerU); ur = 0.5 * FuncAdd(UpperU, -LowerU);
vr = 0.5 * (UpperV - LowerV); vr = 0.5 * FuncAdd(UpperV, -LowerV);
for (j = 1; j <= VOrder; j++) { for (j = 1; j <= VOrder; j++) {
v = vm + vr * GaussPV (j); v = FuncAdd(vm, FuncMul(vr, GaussPV(j)));
dsi = Ixi = Iyi = Izi = Ixxi = Iyyi = Izzi = Ixyi = Ixzi = Iyzi = 0.0; dsi = Ixi = Iyi = Izi = Ixxi = Iyyi = Izzi = Ixyi = Ixzi = Iyzi = 0.0;
for (i = 1; i <= UOrder; i++) { for (i = 1; i <= UOrder; i++) {
u = um + ur * GaussPU (i); u = FuncAdd(um, FuncMul(ur, GaussPU (i)));
S.Normal (u, v, P, VNor); S.Normal (u, v, P, VNor);
ds = VNor.Magnitude() * GaussWU (i); ds = FuncMul(VNor.Magnitude(), GaussWU (i));
P.Coord (x, y, z); P.Coord (x, y, z);
x -= xloc;
y -= yloc; x = FuncAdd(x, -xloc);
z -= zloc; y = FuncAdd(y, -yloc);
dsi += ds; z = FuncAdd(z, -zloc);
Ixi += x * ds;
Iyi += y * ds; dsi = FuncAdd(dsi, ds);
Izi += z * ds;
Ixyi += x * y * ds; const Standard_Real XdS = FuncMul(x, ds);
Iyzi += y * z * ds; const Standard_Real YdS = FuncMul(y, ds);
Ixzi += x * z * ds; const Standard_Real ZdS = FuncMul(z, ds);
x *= x;
y *= y; Ixi = FuncAdd(Ixi, XdS);
z *= z; Iyi = FuncAdd(Iyi, YdS);
Ixxi += (y + z) * ds; Izi = FuncAdd(Izi, ZdS);
Iyyi += (x + z) * ds; Ixyi = FuncAdd(Ixyi, FuncMul(x, YdS));
Izzi += (x + y) * ds; Iyzi = FuncAdd(Iyzi, FuncMul(y, ZdS));
Ixzi = FuncAdd(Ixzi, FuncMul(x, ZdS));
x = Precision::IsInfinite(x) ? Precision::Infinite() : x*x;
y = Precision::IsInfinite(y) ? Precision::Infinite() : y*y;
z = Precision::IsInfinite(z) ? Precision::Infinite() : z*z;
Ixxi = FuncAdd(Ixxi, FuncAdd(YdS, ZdS));
Iyyi = FuncAdd(Iyyi, FuncAdd(XdS, ZdS));
Izzi = FuncAdd(Izzi, FuncAdd(XdS, YdS));
} }
dim += dsi * GaussWV (j);
Ix += Ixi * GaussWV (j); dim = FuncAdd(dim, FuncMul(dsi, GaussWV (j)));
Iy += Iyi * GaussWV (j); Ix = FuncAdd(Ix, FuncMul(Ixi, GaussWV (j)));
Iz += Izi * GaussWV (j); Iy = FuncAdd(Iy, FuncMul(Iyi, GaussWV (j)));
Ixx += Ixxi * GaussWV (j); Iz = FuncAdd(Iz, FuncMul(Izi, GaussWV (j)));
Iyy += Iyyi * GaussWV (j); Ixx = FuncAdd(Ixx, FuncMul(Ixxi, GaussWV (j)));
Izz += Izzi * GaussWV (j); Iyy = FuncAdd(Iyy, FuncMul(Iyyi, GaussWV (j)));
Ixy += Ixyi * GaussWV (j); Izz = FuncAdd(Izz, FuncMul(Izzi, GaussWV (j)));
Iyz += Iyzi * GaussWV (j); Ixy = FuncAdd(Ixy, FuncMul(Ixyi, GaussWV (j)));
Ixz += Ixzi * GaussWV (j); Iyz = FuncAdd(Iyz, FuncMul(Iyzi, GaussWV (j)));
Ixz = FuncAdd(Ixz, FuncMul(Ixzi, GaussWV (j)));
} }
vr *= ur;
Ixx *= vr; vr = FuncMul(vr, ur);
Iyy *= vr; Ixx = FuncMul(vr, Ixx);
Izz *= vr; Iyy = FuncMul(vr, Iyy);
Ixy *= vr; Izz = FuncMul(vr, Izz);
Ixz *= vr; Ixy = FuncMul(vr, Ixy);
Iyz *= vr; Ixz = FuncMul(vr, Ixz);
if (Abs(dim) >= EPS_DIM) { Iyz = FuncMul(vr, Iyz);
if (Abs(dim) >= EPS_DIM)
{
Ix /= dim; Ix /= dim;
Iy /= dim; Iy /= dim;
Iz /= dim; Iz /= dim;
dim *= vr; dim *= vr;
g.SetCoord (Ix, Iy, Iz); g.SetCoord (Ix, Iy, Iz);
} }
else { else
{
dim =0.; dim =0.;
g.SetCoord (0.,0.,0.); g.SetCoord (0.,0.,0.);
} }
inertia = gp_Mat (gp_XYZ (Ixx, -Ixy, -Ixz),
inertia = gp_Mat (gp_XYZ ( Ixx, -Ixy, -Ixz),
gp_XYZ (-Ixy, Iyy, -Iyz), gp_XYZ (-Ixy, Iyy, -Iyz),
gp_XYZ (-Ixz, -Iyz, Izz)); gp_XYZ (-Ixz, -Iyz, Izz));
} }

View File

@ -43,10 +43,10 @@ IntImp_Int2S::IntImp_Int2S() {
IntImp_Int2S::IntImp_Int2S(const ThePSurface& surf1, IntImp_Int2S::IntImp_Int2S(const ThePSurface& surf1,
const ThePSurface& surf2, const ThePSurface& surf2,
const Standard_Real TolTangency ) : const Standard_Real TolTangency ) :
done(Standard_True), done(Standard_True),
empty(Standard_True), empty(Standard_True),
myZerParFunc(surf1,surf2), myZerParFunc(surf1,surf2),
tol(TolTangency*TolTangency) tol(TolTangency*TolTangency)
{ {
ua0 = ThePSurfaceTool::FirstUParameter(surf1); //-- ThePSurfaceTool::UIntervalFirst(surf1); ua0 = ThePSurfaceTool::FirstUParameter(surf1); //-- ThePSurfaceTool::UIntervalFirst(surf1);
va0 = ThePSurfaceTool::FirstVParameter(surf1); //-- ThePSurfaceTool::VIntervalFirst(surf1); va0 = ThePSurfaceTool::FirstVParameter(surf1); //-- ThePSurfaceTool::VIntervalFirst(surf1);
@ -70,10 +70,10 @@ IntImp_Int2S::IntImp_Int2S(const TColStd_Array1OfReal& Param,
const ThePSurface& surf1, const ThePSurface& surf1,
const ThePSurface& surf2, const ThePSurface& surf2,
const Standard_Real TolTangency ) : const Standard_Real TolTangency ) :
done(Standard_True), done(Standard_True),
empty(Standard_True), empty(Standard_True),
myZerParFunc(surf1,surf2), myZerParFunc(surf1,surf2),
tol(TolTangency*TolTangency) tol(TolTangency*TolTangency)
{ {
math_FunctionSetRoot Rsnld(myZerParFunc,15); //-- Modif lbr 18 MAI ????????????? math_FunctionSetRoot Rsnld(myZerParFunc,15); //-- Modif lbr 18 MAI ?????????????
ua0 = ThePSurfaceTool::FirstUParameter(surf1); //-- ThePSurfaceTool::UIntervalFirst(surf1); ua0 = ThePSurfaceTool::FirstUParameter(surf1); //-- ThePSurfaceTool::UIntervalFirst(surf1);
@ -94,19 +94,19 @@ IntImp_Int2S::IntImp_Int2S(const TColStd_Array1OfReal& Param,
Perform(Param,Rsnld); Perform(Param,Rsnld);
} }
IntImp_ConstIsoparametric IntImp_Int2S:: IntImp_ConstIsoparametric IntImp_Int2S:: Perform(const TColStd_Array1OfReal& Param,
Perform(const TColStd_Array1OfReal& Param,
math_FunctionSetRoot& Rsnld, math_FunctionSetRoot& Rsnld,
const IntImp_ConstIsoparametric ChoixIso ) const IntImp_ConstIsoparametric ChoixIso)
{ {
Standard_Real BornInfBuf[3], BornSupBuf[3], ToleranceBuf[3], UVapBuf[3]; Standard_Real BornInfBuf[3], BornSupBuf[3], ToleranceBuf[3], UVapBuf[3];
Standard_Real UvresBuf[4]; Standard_Real UvresBuf[4];
math_Vector BornInf (BornInfBuf, 1, 3), BornSup (BornSupBuf, 1, 3), Tolerance (ToleranceBuf, 1, 3), UVap (UVapBuf, 1, 3); math_Vector BornInf (BornInfBuf, 1, 3), BornSup (BornSupBuf, 1, 3),
Tolerance (ToleranceBuf, 1, 3), UVap (UVapBuf, 1, 3);
TColStd_Array1OfReal Uvres (UvresBuf[0], 1, 4); TColStd_Array1OfReal Uvres (UvresBuf[0], 1, 4);
IntImp_ConstIsoparametric BestChoix; IntImp_ConstIsoparametric BestChoix;
myZerParFunc.ComputeParameters(ChoixIso,Param,UVap,
BornInf,BornSup,Tolerance); myZerParFunc.ComputeParameters(ChoixIso,Param,UVap,BornInf,BornSup,Tolerance);
Rsnld.SetTolerance(Tolerance); Rsnld.SetTolerance(Tolerance);
Rsnld.Perform(myZerParFunc,UVap,BornInf,BornSup); Rsnld.Perform(myZerParFunc,UVap,BornInf,BornSup);
BestChoix = ChoixIso; BestChoix = ChoixIso;
@ -133,8 +133,7 @@ IntImp_ConstIsoparametric IntImp_Int2S::
return BestChoix; return BestChoix;
} }
IntImp_ConstIsoparametric IntImp_Int2S:: Perform( IntImp_ConstIsoparametric IntImp_Int2S:: Perform(const TColStd_Array1OfReal& Param,
const TColStd_Array1OfReal& Param,
math_FunctionSetRoot& Rsnld) math_FunctionSetRoot& Rsnld)
{ {
gp_Vec DPUV[4]; gp_Vec DPUV[4];
@ -157,15 +156,20 @@ IntImp_ConstIsoparametric IntImp_Int2S:: Perform(
Epsuv[2] = ThePSurfaceTool::UResolution(Caro2,Precision::Confusion()); Epsuv[2] = ThePSurfaceTool::UResolution(Caro2,Precision::Confusion());
Epsuv[3] = ThePSurfaceTool::VResolution(Caro2,Precision::Confusion()); Epsuv[3] = ThePSurfaceTool::VResolution(Caro2,Precision::Confusion());
for (Standard_Integer j=0;j<=3;j++) UVd[j] = Param(j+1); for (Standard_Integer j=0;j<=3;j++)
UVd[j] = Param(j+1);
empty = Standard_True; empty = Standard_True;
Standard_Boolean Tangent = IntImp_ComputeTangence(DPUV,Epsuv,UVd,ChoixIso); Standard_Boolean Tangent = IntImp_ComputeTangence(DPUV,Epsuv,UVd,ChoixIso);
if (Tangent) return BestChoix; if (Tangent)
return BestChoix;
Standard_Integer i=0; Standard_Integer i=0;
IntImp_ConstIsoparametric CurrentChoix = BestChoix; //-- Modif 17 Mai 93 IntImp_ConstIsoparametric CurrentChoix = BestChoix; //-- Modif 17 Mai 93
while (empty && i<= 3) {
while (empty && i<= 3)
{
CurrentChoix = Perform(Param,Rsnld,ChoixIso[i]); CurrentChoix = Perform(Param,Rsnld,ChoixIso[i]);
if(!empty) { if(!empty) {
BestChoix = CurrentChoix; BestChoix = CurrentChoix;
@ -233,18 +237,28 @@ IntImp_ConstIsoparametric IntImp_Int2S:: Perform(
if (!empty) { // verification si l on ne deborde pas sur le carreau if (!empty) { // verification si l on ne deborde pas sur le carreau
// reciproque // reciproque
Nc =3-Nc; Nc =3-Nc;
if (Duv(Nc) <= UVd[Nc-1]-Epsuv[Nc-1]) Duv(Nc)=UVd[Nc-1]; if (Duv(Nc) <= UVd[Nc-1]-Epsuv[Nc-1])
else if (Duv(Nc) >=UVf[Nc-1]+Epsuv[Nc-1]) Duv(Nc)=UVf[Nc-1]; Duv(Nc)=UVd[Nc-1];
else if (Duv(Nc+1) <= UVd[Nc]) { else if (Duv(Nc) >=UVf[Nc-1]+Epsuv[Nc-1])
Nc = Nc +1; Duv(Nc)=UVf[Nc-1];
else if (Duv(Nc+1) <= UVd[Nc])
{
Nc = Nc + 1;
Duv(Nc)=UVd[Nc-1]; Duv(Nc)=UVd[Nc-1];
} }
else if (Duv(Nc+1) >=UVf[Nc]) { else if (Duv(Nc+1) >=UVf[Nc])
Nc = Nc +1; {
Nc = Nc + 1;
Duv(Nc)=UVf[Nc-1]; Duv(Nc)=UVf[Nc-1];
} }
else return BestChoix; else
return BestChoix;
empty = Standard_True; empty = Standard_True;
if(Nc == 4)
Nc = 0;
BestChoix = ChoixRef[Nc]; //en attendant BestChoix = ChoixRef[Nc]; //en attendant
BestChoix = Perform(Duv,Rsnld,BestChoix); BestChoix = Perform(Duv,Rsnld,BestChoix);
} }

View File

@ -379,11 +379,9 @@ Standard_Boolean IntWalk_PWalking::PerformFirstPoint (const TColStd_Array1OfRea
close = Standard_False; close = Standard_False;
// //
Standard_Integer i; Standard_Integer i;
Standard_Real aTmp;
TColStd_Array1OfReal Param(1,4); TColStd_Array1OfReal Param(1,4);
// //
for (i=1; i<=4; ++i) { for (i=1; i<=4; ++i) {
aTmp = ParDep(i);
Param(i) = ParDep(i); Param(i) = ParDep(i);
} }
//-- calculate the first solution point //-- calculate the first solution point
@ -393,9 +391,11 @@ Standard_Boolean IntWalk_PWalking::PerformFirstPoint (const TColStd_Array1OfRea
if (!myIntersectionOn2S.IsDone()) { if (!myIntersectionOn2S.IsDone()) {
return Standard_False; return Standard_False;
} }
if (myIntersectionOn2S.IsEmpty()) { if (myIntersectionOn2S.IsEmpty()) {
return Standard_False; return Standard_False;
} }
FirstPoint = myIntersectionOn2S.Point(); FirstPoint = myIntersectionOn2S.Point();
return Standard_True; return Standard_True;
} }

View File

@ -9,7 +9,7 @@ puts ""
# Fuse problem of symetrical shapes. Appendix for NPAL19789 # Fuse problem of symetrical shapes. Appendix for NPAL19789
####################################################################### #######################################################################
cpulimit 500 cpulimit 1000
#cpulimit 4500 #cpulimit 4500
set BugNumber OCC19793 set BugNumber OCC19793