1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0025772: Boolean operation produces invalid result after patch for 0025416

Patch for bug #0025416 and #0025697

Test cases for the issue #25416 and #25697 have been added.
New test case for this issue has been created.
This commit is contained in:
nbv
2015-02-02 16:15:39 +03:00
parent 967b56d5d8
commit 859eb523ce
16 changed files with 1048 additions and 780 deletions

View File

@@ -541,19 +541,19 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
const char** a)
{
if (n<3) {
di << " use bopcurves F1 F2\n";
di << " use bopcurves F1 F2 [-2d/-2d1/-2d2]\n";
return 1;
}
//
TopoDS_Shape S1 = DBRep::Get(a[1]);
TopoDS_Shape S2 = DBRep::Get(a[2]);
TopAbs_ShapeEnum aType;
//
if (S1.IsNull() || S2.IsNull()) {
di << " Null shapes is not allowed \n";
return 1;
}
//
aType=S1.ShapeType();
if (aType != TopAbs_FACE) {
di << " Type mismatch F1\n";
@@ -564,38 +564,53 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
di << " Type mismatch F2\n";
return 1;
}
//
const TopoDS_Face& aF1=*(TopoDS_Face*)(&S1);
const TopoDS_Face& aF2=*(TopoDS_Face*)(&S2);
//
Standard_Boolean aToApproxC3d, aToApproxC2dOnS1, aToApproxC2dOnS2, anIsDone;
Standard_Integer i, aNbCurves;
Standard_Real anAppTol, aTolR;
TCollection_AsciiString aNm("c_");
//
anAppTol = 0.0000001;
aToApproxC3d = Standard_True;
aToApproxC2dOnS1 = Standard_False;
aToApproxC2dOnS2 = Standard_False;
anAppTol=0.0000001;
//
if (n > 3) {
if (!strcasecmp(a[3],"-2d")) {
aToApproxC2dOnS1 = Standard_True;
aToApproxC2dOnS2 = Standard_True;
}
else if (!strcasecmp(a[3],"-2d1")) {
aToApproxC2dOnS1 = Standard_True;
}
else if (!strcasecmp(a[3],"-2d2")) {
aToApproxC2dOnS2 = Standard_True;
}
else {
di << "Wrong key. To build 2d curves use: bopcurves F1 F2 -2d/-2d1/-2d2 \n";
return 1;
}
}
//
IntTools_FaceFace aFF;
//
aFF.SetParameters (aToApproxC3d,
aToApproxC2dOnS1,
aToApproxC2dOnS2,
anAppTol);
//
aFF.Perform (aF1, aF2);
//
anIsDone=aFF.IsDone();
if (!anIsDone) {
di << " anIsDone=" << (Standard_Integer) anIsDone << "\n";
return 1;
}
aFF.PrepareLines3D();
//
aFF.PrepareLines3D(Standard_False);
const IntTools_SequenceOfCurves& aSCs=aFF.Lines();
//
@@ -607,6 +622,10 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
di << " has no 3d curve\n";
return 1;
}
else
{
di << aNbCurves << " curve(s) found.\n";
}
for (i=1; i<=aNbCurves; i++) {
const IntTools_Curve& anIC=aSCs(i);
@@ -614,18 +633,49 @@ Standard_Integer bopcurves (Draw_Interpretor& di,
Handle (Geom_Curve) aC3D = anIC.Curve();
if (aC3D.IsNull()) {
di << " has Null 3d curve# " << i << "%d\n";
di << " has Null 3d curve# " << i << "\n";
continue;
}
TCollection_AsciiString anIndx(i), aNmx;
aNmx = aNm + anIndx;
Standard_CString name= aNmx.ToCString();
DrawTrSurf::Set(name, aC3D);
di << name << " ";
Standard_CString nameC = aNmx.ToCString();
DrawTrSurf::Set(nameC, aC3D);
di << nameC << " ";
//
Handle(Geom2d_Curve) aPC1 = anIC.FirstCurve2d();
Handle(Geom2d_Curve) aPC2 = anIC.SecondCurve2d();
//
if (!aPC1.IsNull() || !aPC2.IsNull()) {
di << "(";
//
if (!aPC1.IsNull()) {
TCollection_AsciiString pc1N("c2d1_"), pc1Nx;
pc1Nx = pc1N + anIndx;
Standard_CString nameC2d1 = pc1Nx.ToCString();
//
DrawTrSurf::Set(nameC2d1, aPC1);
di << nameC2d1;
}
//
if (!aPC2.IsNull()) {
TCollection_AsciiString pc2N("c2d2_"), pc2Nx;
pc2Nx = pc2N + anIndx;
Standard_CString nameC2d2 = pc2Nx.ToCString();
//
DrawTrSurf::Set(nameC2d2, aPC2);
//
if (!aPC1.IsNull()) {
di << ", ";
}
di << nameC2d2;
}
di << ") ";
}
}
//
di << "\n";
return 0;
}

View File

@@ -1 +1,2 @@
BRepCheck_SurfNormAnalyzer.hxx
BRepCheck_SurfNormAnalyzer.cxx

View File

@@ -571,6 +571,7 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
}
//
Nblines = iwalk.NbLines();
const Standard_Integer aMinNbWLPoins = 40;
for (j=1; j<=Nblines; j++) {
const Handle(IntPatch_TheIWLineOfTheIWalking)& iwline = iwalk.Value(j);
const Handle(IntSurf_LineOn2S)& thelin = iwline->Line();
@@ -891,75 +892,27 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
wline->SetLastPoint(wline->NbVertex());
}
if(wline->NbPnts() < 40)
if(wline->NbPnts() < aMinNbWLPoins)
{
Standard_Boolean hasBeenAdded = iwalk.SeekAdditionalPoints(Surf1, Surf2, 40, j);
if (!reversed)
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang, hasBeenAdded);
else
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang, hasBeenAdded);
if(hasBeenAdded)
Standard_Integer aDeltaParam = 0;
for(Standard_Integer aVertNum = 1; aVertNum < wline->NbVertex(); aVertNum++)
{
const Standard_Real aTol = Precision::Confusion()*Precision::Confusion();
Standard_Real aDecrParam = 0.0;
Standard_Integer aNbVert = wline->NbVertex();
for (Standard_Integer aV = 2; aV <= aNbVert; aV++)
{
IntPatch_Point aVert = wline->Vertex(aV);
const Standard_Integer aFirst =
RealToInt(wline->Vertex(aVertNum).ParameterOnLine());
const Standard_Integer aLast =
RealToInt(wline->Vertex(aVertNum + 1).ParameterOnLine());
const gp_Pnt aP(aVert.Value()), aP1(wline->Vertex(aV-1).Value());
const Standard_Integer aNbPoints = wline->NbPnts();
if(aV == aNbVert)
{
if(aP.SquareDistance(aP1) <= aTol)
{
wline->RemoveVertex(aV-1);
}
iwalk.SeekAdditionalPoints(Surf1, Surf2, aFirst, aLast, aMinNbWLPoins, j);
break;
}
else
{
aVert.SetParameter(aVert.ParameterOnLine() - aDecrParam);
wline->RemoveVertex(aV);
wline->InsertVertexBefore(aV, aVert);
}
aDeltaParam += (wline->NbPnts() - aNbPoints);
const gp_Pnt aP2(wline->Vertex(aV+1).Value());
if(aP.SquareDistance(aP1) <= aTol)
{
wline->RemoveVertex(aV);
}
else if(aP.SquareDistance(aP2) <= aTol)
{
wline->RemoveVertex(aV);
aDecrParam++;
aV--;
aNbVert = wline->NbVertex();
}
aNbVert = wline->NbVertex();
IntPatch_Point aVert = wline->Vertex(aVertNum + 1);
aVert.SetParameter(aLast + aDeltaParam);
wline->Replace(aVertNum + 1, aVert);
}
}
if (wline->HasLastPoint())
{
wline->SetLastPoint(wline->NbVertex());
wline->LastPoint(indlast);
}
}
else
{
if (!reversed)
IntPatch_RstInt::PutVertexOnLine(wline,Surf1,D1,Surf2,Standard_True,TolTang);
else
IntPatch_RstInt::PutVertexOnLine(wline,Surf2,D2,Surf1,Standard_False,TolTang);
}
//
// Il faut traiter les points de passage.
slin.Append(wline);
@@ -1323,17 +1276,11 @@ void IntPatch_ImpPrmIntersection::Perform (const Handle(Adaptor3d_HSurface)& Sur
for (i=1; i<=slin.Length(); i++)
{
Handle(IntPatch_Line)& aL = slin(i);
const Handle(IntPatch_WLine)& wline = Handle(IntPatch_WLine)::DownCast(aL);
if(!wline.IsNull())
{//It was processed above
continue;
}
if (!reversed)
IntPatch_RstInt::PutVertexOnLine(aL,Surf1,D1,Surf2,Standard_True,TolTang, 1);
IntPatch_RstInt::PutVertexOnLine(aL,Surf1,D1,Surf2,Standard_True,TolTang);
else
IntPatch_RstInt::PutVertexOnLine(aL,Surf2,D2,Surf1,Standard_False,TolTang, 1);
IntPatch_RstInt::PutVertexOnLine(aL,Surf2,D2,Surf1,Standard_False,TolTang);
}
empt = (slin.Length() == 0 && spnt.Length() == 0);
done = Standard_True;

View File

@@ -309,18 +309,6 @@ is
---C++: return const&
returns HCurve2d from Adaptor2d;
ClearVertexes(me: mutable)
is static;
RemoveVertex(me: mutable;
theIndex : Integer from Standard)
is static;
InsertVertexBefore(me: mutable;
theIndex : Integer from Standard;
thePnt : Point from IntPatch)
is static;
Dump(me)
is static;

View File

@@ -1079,7 +1079,7 @@ void IntPatch_WLine::Dump() const {
for(i=1;i<=nbp;i++) {
Standard_Real u1,v1,u2,v2;
Point(i).Parameters(u1,v1,u2,v2);
printf("%4d [%+5.8e %+5.8e %+5.8e] [%+5.8e %+5.8e] [%+5.8e %+5.8e]\n",
printf("%4d [%+10.20f %+10.20f %+10.20f] [%+10.20f %+10.20f] [%+10.20f %+10.20f]\n",
i,
Point(i).Value().X(),
Point(i).Value().Y(),

View File

@@ -97,27 +97,3 @@ inline const IntPatch_Point& IntPatch_WLine::Vertex (const Standard_Integer Inde
{
return svtx(Index);
}
inline void IntPatch_WLine::ClearVertexes()
{
svtx.Clear();
}
inline void IntPatch_WLine::RemoveVertex(const Standard_Integer theIndex)
{
if((theIndex < 1) || (theIndex > NbVertex()))
Standard_OutOfRange::Raise("Cannot delete not existing vertex");
svtx.Remove(theIndex);
}
inline void IntPatch_WLine::InsertVertexBefore( const Standard_Integer theIndex,
const IntPatch_Point& thePnt)
{
const Standard_Integer aNbVertexes = NbVertex();
Standard_Integer anIndex = Max(theIndex, 1);
if(anIndex > aNbVertexes)
svtx.Append(thePnt);
else
svtx.InsertBefore(theIndex, thePnt);
}

View File

@@ -77,7 +77,7 @@ void IntTools_LineConstructor::Perform(const Handle(IntPatch_Line)& L)
{
Standard_Integer i,nbvtx;
Standard_Real firstp,lastp;
const Standard_Real Tol = 1.001e-6;//Precision::PConfusion() * 35.0;
const Standard_Real Tol = Precision::PConfusion() * 35.0;
const IntPatch_IType typl = L->ArcType();
if(typl == IntPatch_Analytic) {

View File

@@ -319,6 +319,7 @@ is
SeekAdditionalPoints( me : in out;
theASurf1 , theASurf2 : ThePSurface;
theFromPoint, theToPoint : Integer from Standard;
theMinNbPoints : Integer from Standard;
theNCurve : Integer from Standard)
returns Boolean from Standard;

View File

@@ -1619,12 +1619,15 @@ Standard_Boolean IntWalk_IWalking::
//=======================================================================
//function : SeekAdditionalPoints
//purpose : This function is same as in IntWalk_PWalking_1.gxx file.
// If you change it, you should change and that function too.
//purpose : If you are changing this function please pay attention to
// the analogical function in IntWalk_PWalking_1.gxx file.
// Do there necessary corrections too.
//=======================================================================
Standard_Boolean IntWalk_IWalking::
SeekAdditionalPoints( const ThePSurface& theASurf1,
const ThePSurface& theASurf2,
const Standard_Integer theFromPoint,
const Standard_Integer theToPoint,
const Standard_Integer theMinNbPoints,
const Standard_Integer theNCurve)
{
@@ -1644,16 +1647,17 @@ Standard_Boolean IntWalk_IWalking::
const Standard_Real aV2bFirst = theASurf2->FirstVParameter();
const Standard_Real aV2bLast = theASurf2->LastVParameter();
Standard_Integer aLastPoint = theToPoint;
Standard_Boolean isPrecise = Standard_False;
Standard_Real U1prec = 0.0, V1prec = 0.0, U2prec = 0.0, V2prec = 0.0;
Standard_Integer aNbPointsPrev = 0;
while(aNbPoints < theMinNbPoints && (aNbPoints != aNbPointsPrev))
while((aLastPoint - theFromPoint) < theMinNbPoints && (aNbPoints != aNbPointsPrev))
{
aNbPointsPrev = aNbPoints;
for(Standard_Integer fp = 1, lp = 2; fp < aNbPoints; fp = lp + 1)
for(Standard_Integer fp = theFromPoint, lp = theFromPoint+1; fp < aLastPoint; fp = lp + 1)
{
Standard_Real U1f, V1f, U2f, V2f; //first point in 1st and 2nd surafaces
Standard_Real U1l, V1l, U2l, V2l; //last point in 1st and 2nd surafaces
@@ -1719,20 +1723,28 @@ Standard_Boolean IntWalk_IWalking::
}
while(!aStatus && (--aNbIter > 0));
//if((U1prec-U1f)*(U1l-U1prec) < 0.0)
// aStatus = Standard_False;
//if((U2prec-U2f)*(U2l-U2prec) < 0.0)
// aStatus = Standard_False;
//if((V1prec-V1f)*(V1l-V1prec) < 0.0)
// aStatus = Standard_False;
//if((V2prec-V2f)*(V2l-V2prec) < 0.0)
// aStatus = Standard_False;
if(aStatus)
{
if(U1prec < aU1bFirst)
U1prec = aU1bFirst;
if(U1prec > aU1bLast)
U1prec = aU1bLast;
if(V1prec < aV1bFirst)
V1prec = aV1bFirst;
if(V1prec > aV1bLast)
V1prec = aV1bLast;
if(U2prec < aU2bFirst)
U2prec = aU2bFirst;
if(U2prec > aU2bLast)
U2prec = aU2bLast;
if(V2prec < aV2bFirst)
V2prec = aV2bFirst;
if(V2prec > aV2bLast)
V2prec = aV2bLast;
gp_Pnt aP1 = theASurf1->Value(U1prec, V1prec),
aP2 = theASurf2->Value(U2prec, V2prec);
gp_Pnt aPInt(0.5*(aP1.XYZ() + aP2.XYZ()));
@@ -1747,9 +1759,10 @@ Standard_Boolean IntWalk_IWalking::
line->InsertBefore(lp, anIP);
isPrecise = Standard_True;
aLastPoint++;
aNbPoints = line->NbPoints();
if(aNbPoints >= theMinNbPoints)
if((aLastPoint - theFromPoint) >= theMinNbPoints)
break;
}
else

View File

@@ -161,9 +161,8 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
StatusPrecedent = IntWalk_OK;
// modified by NIZHNY-MKK Fri Oct 27 12:39:37 2000
Standard_Integer IndexOfPathPointDoNotCheck=0;
Standard_Integer aNbIter = 10;
while (!Arrive) { // as one of stop tests is not checked
Cadre = Cadrage(BornInf,BornSup,UVap,PasC,StepSign);
// Border?
@@ -338,6 +337,10 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
previousd2d = Func.Direction2d();
CurrentLine->AddPoint(previousPoint);
}
else if (Status == IntWalk_PointConfondu)
{
aNbIter --;
}
}
}
else { // no numerical solution
@@ -353,6 +356,9 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
seqAjout.Append(lines.Length() + 1);
}
}
if(aNbIter < 0)
break;
} // end of started line
if (Arrive) {
@@ -372,7 +378,8 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
((av!=I) &&
(av!=IndexOfPathPointDoNotCheck) &&
(wd1[av].etat < -11) &&
(movementdirectioninfo[av]!=0))) {
(movementdirectioninfo[av]!=0)))
{
// modified by NIZHNY-MKK Fri Oct 27 13:00:26 2000.END
Standard_Real Uav=wd1[av].ustart;
Standard_Real Vav=wd1[av].vstart;
@@ -428,7 +435,6 @@ void IntWalk_IWalking::ComputeOpenLine(const TColStd_SequenceOfReal& Umult,
}
}
}
}
} //end of point processing
} //end of all points

View File

@@ -79,8 +79,8 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
Standard_Integer nbLoop = Pnts2.Length();
for (I = 1;I<=nbLoop;I++) {
if (wd2[I].etat > 12) { // start point of closed line
if (wd2[I].etat > 12)
{ // start point of closed line
LoopPnt = Pnts2.Value(I);
previousPoint.SetValue(ThePointOfLoopTool::Value3d(LoopPnt),reversed,
wd2[I].ustart,wd2[I].vstart);
@@ -117,6 +117,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
ArretAjout = Standard_False;
NbDivision = 0;
StatusPrecedent = IntWalk_OK;
Standard_Integer aNbIter = 10;
while (!Arrive) { // as no test of stop is passed
Cadre=Cadrage(BornInf,BornSup,Uvap,PasC, StepSign); // border?
#ifdef CHRONO
@@ -163,7 +164,6 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
//in case if there is a frame and arrival at the same time
}
else { // modif jag 940615
if (Rajout) { // test on added points
ArretAjout =TestArretAjout(Func,Uvap,N,Psol);
if (ArretAjout) {
@@ -192,6 +192,7 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
}
Status = TestDeflection(Func, Arrive,Uvap,StatusPrecedent,
NbDivision,PasC,StepSign);
StatusPrecedent = Status;
if (Status == IntWalk_PasTropGrand) {// division of the step
Arrive = Standard_False;
@@ -237,7 +238,6 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
}
}
}
else if ( Status == IntWalk_ArretSurPointPrecedent) {
if (CurrentLine->NbPoints() == 1) { //cancel the line
Arrive = Standard_False;
@@ -312,6 +312,10 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
previousd2d = Func.Direction2d();
CurrentLine->AddPoint(previousPoint);
}
else if (Status == IntWalk_PointConfondu)
{
aNbIter --;
}
}
}
else { //no numerical solution NotDone
@@ -329,6 +333,9 @@ void IntWalk_IWalking::ComputeCloseLine(const TColStd_SequenceOfReal& Umult,
seqAjout.Append(lines.Length()+1);
}
}
if(aNbIter < 0)
break;
}// end of started line
if (Arrive) {
CurrentLine->SetTangencyAtBegining(Tgtbeg);

View File

@@ -58,39 +58,46 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
//-- if epsilon is great enough (1e-11). In this case one loops
//-- without ever changing the values sent to Rsnld.
//---------------------------------------------------------------------------------
Standard_Real Paramu, Paramv, StepU,StepV;
Standard_Real Cosi, Cosi2, Norme;
Standard_Real Paramu = 0.0, Paramv = 0.0;
if (!reversed) {
previousPoint.ParametersOnS2(Paramu, Paramv);
}
else
{
previousPoint.ParametersOnS1(Paramu, Paramv);
}
const Standard_Real Du = UV(1) - Paramu;
const Standard_Real Dv = UV(2) - Paramv;
const Standard_Real Duv = Du * Du + Dv * Dv;
gp_Vec Corde(previousPoint.Value(), sp.Point());
Norme = Corde.SquareMagnitude();
// if (Norme <= epsilon*epsilon) {
if ((++NbPointsConfondusConsecutifs < 10) && (Norme <= epsilon)) { // the square is already taken in the constructor
const Standard_Real Norme = Corde.SquareMagnitude(),
aTol = epsilon*Precision::PConfusion();
//if ((++NbPointsConfondusConsecutifs < 10) && (Norme <= epsilon)) { // the square is already taken in the constructor
if ((Norme <= epsilon) && ((Duv <= aTol) || (StatusPrecedent != IntWalk_OK)))
{ // the square is already taken in the constructor
Status = IntWalk_PointConfondu;
if (StatusPrecedent == IntWalk_PasTropGrand) {
return IntWalk_ArretSurPointPrecedent;
}
if(++EpsilonSembleTropGrand > 5 && NbPointsConfondusConsecutifs == 8) { //-- Temporary
if(epsilon>0.00000000001) epsilon*=0.5; //-- Temporary
EpsilonSembleTropGrand = 0; //-- Temporary
}
}
else {
NbPointsConfondusConsecutifs = 0; //-- Temporary
EpsilonSembleTropGrand = 0; //-- Temporary
if(Norme<1e-16) Norme = 1e-16; //-- Temporary
Standard_Real Cosi = Corde * previousd3d;
Standard_Real Cosi2 = 0.0;
Cosi = Corde * previousd3d;
if (Cosi*StepSign < 0.) { // angle 3d > pi/2 !!!!
Cosi2 = 0.;
}
else {
Cosi2 = Cosi * Cosi / previousd3d.SquareMagnitude() / Norme;
if (Cosi*StepSign >= 0.) {// angle 3d <= pi/2 !!!!
const Standard_Real aDiv = previousd3d.SquareMagnitude()*Norme;
if(aDiv == 0)
return Status;
Cosi2 = Cosi * Cosi / aDiv;
}
if (Cosi2 < CosRef3D) { //angle 3d too great
Step = Step /2.0;
StepU = Abs(Step*previousd2d.X());
Standard_Real StepU = Abs(Step*previousd2d.X()),
StepV = Abs(Step*previousd2d.Y());
if (StepU < tolerance(1) && StepV < tolerance(2))
Status = IntWalk_ArretSurPointPrecedent;
@@ -100,37 +107,28 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
}
}
if (!reversed) {
previousPoint.ParametersOnS2(Paramu, Paramv);
}
else {
previousPoint.ParametersOnS1(Paramu, Paramv);
}
Standard_Real Du = UV(1) - Paramu;
Standard_Real Dv = UV(2) - Paramv;
Standard_Real Duv = Du * Du + Dv * Dv;
if (Abs(Du) < tolerance(1) && Abs(Dv) < tolerance(2))
return IntWalk_ArretSurPointPrecedent; //confused point 2d
Cosi = StepSign * (Du * previousd2d.X() +
Dv * previousd2d.Y());
Standard_Real Cosi = StepSign * (Du * previousd2d.X() + Dv * previousd2d.Y());
if (Cosi < 0 && Status == IntWalk_PointConfondu)
return IntWalk_ArretSurPointPrecedent; // leave as step back
// with confused point
if (sp.IsTangent())
return IntWalk_ArretSurPoint;
//if during routing one has subdivided more than MaxDivision for each
//previous step, bug on the square; do nothing (experience U4)
if (NbDivision < MaxDivision &&
Status != IntWalk_PointConfondu &&
StatusPrecedent!= IntWalk_PointConfondu ) {
Cosi2 = Cosi * Cosi / Duv;
if ((NbDivision < MaxDivision) && (Status != IntWalk_PointConfondu) &&
(StatusPrecedent!= IntWalk_PointConfondu))
{
Standard_Real Cosi2 = Cosi * Cosi / Duv;
if (Cosi2 < CosRef2D || Cosi < 0 ) {
Step = Step / 2.0;
StepU = Abs(Step*previousd2d.X());
Standard_Real StepU = Abs(Step*previousd2d.X()),
StepV = Abs(Step*previousd2d.Y());
if (StepU < tolerance(1) && StepV < tolerance(2))
@@ -145,7 +143,7 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
Cosi2 = Cosi * Cosi / sp.Direction3d().SquareMagnitude() / Norme;
if (Cosi2 < CosRef3D ){ //angle 3d too great
Step = Step / 2.;
StepU = Abs(Step*previousd2d.X());
Standard_Real StepU = Abs(Step*previousd2d.X()),
StepV = Abs(Step*previousd2d.Y());
if (StepU < tolerance(1) && StepV < tolerance(2))
Status = IntWalk_ArretSurPoint;
@@ -160,7 +158,7 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
sp.Direction2d() * previousd2d < 0) {
//angle 2d too great or change the side
Step = Step / 2.;
StepU = Abs(Step*previousd2d.X());
Standard_Real StepU = Abs(Step*previousd2d.X()),
StepV = Abs(Step*previousd2d.Y());
if (StepU < tolerance(1) && StepV < tolerance(2))
Status = IntWalk_ArretSurPointPrecedent;
@@ -171,28 +169,29 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
}
if (!Finished) {
if (Status == IntWalk_PointConfondu) {
StepU = Min(Abs(1.5 * Du),pas*(UM-Um));
if (Status == IntWalk_PointConfondu)
{
Standard_Real StepU = Min(Abs(1.5 * Du),pas*(UM-Um)),
StepV = Min(Abs(1.5 * Dv),pas*(VM-Vm));
Standard_Real d2dx = Abs(previousd2d.X());
Standard_Real d2dy = Abs(previousd2d.Y());
if (d2dx < tolerance(1)) {
if (d2dx < tolerance(1))
{
Step = StepV/d2dy;
}
else if (d2dy < tolerance(2)) {
else if (d2dy < tolerance(2))
{
Step = StepU/d2dx;
}
else {
else
{
Step = Min(StepU/d2dx,StepV/d2dy);
}
}
else {
else
{
// estimate the current vector.
// if vector/2<=current vector<= vector it is considered that the criterion
// is observed.
@@ -231,50 +230,59 @@ IntWalk_StatusDeflection IntWalk_IWalking::TestDeflection
// if (FlecheCourante <= 0.5*fleche) {
if (FlecheCourante <= 0.25*fleche*fleche) {
if (FlecheCourante <= 0.25*fleche*fleche)
{
Standard_Real d2dx = Abs(sp.Direction2d().X());
Standard_Real d2dy = Abs(sp.Direction2d().Y());
StepU = Min(Abs(1.5*Du),pas*(UM-Um));
Standard_Real StepU = Min(Abs(1.5*Du),pas*(UM-Um)),
StepV = Min(Abs(1.5*Dv),pas*(VM-Vm));
if (d2dx < tolerance(1)) {
if (d2dx < tolerance(1))
{
Step = StepV/d2dy;
}
else if (d2dy < tolerance(2)) {
else if (d2dy < tolerance(2))
{
Step = StepU/d2dx;
}
else {
else
{
Step = Min(StepU/d2dx,StepV/d2dy);
}
}
else {
else
{
//if (FlecheCourante > fleche) { // step too great
if (FlecheCourante > fleche*fleche) { // step too great
if (FlecheCourante > fleche*fleche)
{ // step too great
Step = Step /2.;
StepU = Abs(Step*previousd2d.X());
Standard_Real StepU = Abs(Step*previousd2d.X()),
StepV = Abs(Step*previousd2d.Y());
if (StepU < tolerance(1) && StepV < tolerance(2))
Status = IntWalk_ArretSurPointPrecedent;
else
Status = IntWalk_PasTropGrand;
}
else {
else
{
Standard_Real d2dx = Abs(sp.Direction2d().X());
Standard_Real d2dy = Abs(sp.Direction2d().Y());
StepU = Min(Abs(1.5*Du),pas*(UM-Um));
Standard_Real StepU = Min(Abs(1.5*Du),pas*(UM-Um)),
StepV = Min(Abs(1.5*Dv),pas*(VM-Vm));
if (d2dx < tolerance(1)) {
if (d2dx < tolerance(1))
{
Step = Min(Step,StepV/d2dy);
}
else if (d2dy < tolerance(2)) {
else if (d2dy < tolerance(2))
{
Step = Min(Step,StepU/d2dx);
}
else {
else
{
Step = Min(Step,Min(StepU/d2dx,StepV/d2dy));
}
}

View File

@@ -0,0 +1,124 @@
puts "================"
puts "OCC25416"
puts "================"
puts ""
#######################################################################
# Face/Face intersection algorithm gives different results for different order of the arguments
#######################################################################
# Check if list of xdistcs-command is valid
proc checkList {List Tolerance D_good Limit_Tol} {
set L1 [llength ${List}]
set L2 10
set L3 5
set N [expr (${L1} - ${L2})/${L3} + 1]
for {set i 1} {${i} <= ${N}} {incr i} {
set j1 [expr ${L2} + (${i}-1)*${L3}]
set j2 [expr ${j1} + 2]
set T [lindex ${List} ${j1}]
set D [lindex ${List} ${j2}]
#puts "i=${i} j1=${j1} j2=${j2} T=${T} D=${D}"
if { [expr abs(${D} - ${D_good})] > ${Tolerance} } {
puts "Error: T=${T} D=${D}"
}
if { ${Tolerance} > ${Limit_Tol} } {
if { [expr abs(${D} - ${D_good})] > ${Limit_Tol}
&& [expr abs(${D} - ${D_good})] <= ${Tolerance} } {
puts "Attention (critical value of tolerance) : T=${T} D=${D}"
}
}
}
}
puts "##############################"
puts "#!!!Search \"Attention\" keyword on this web-page for additional checking!!!"
puts "##############################"
puts ""
puts ""
# bopcurves command
restore [locate_data_file bug25416_f1.brep] f1
restore [locate_data_file bug25416_f2.brep] f2
#############################
set log [bopcurves f1 f2 -2d]
#############################
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
set MaxTol 1.e-6
#This value must be equal to the analogical value in bug25292_31 and bug25292_32 of "bugs modalg_5" testgrid.
set GoodNbCurv 1
if {${Toler} > ${MaxTol}} {
puts "Error: Tolerance is too big!"
}
if {${NbCurv} != ${GoodNbCurv}} {
puts "Error: Curve Number is bad!"
}
#-------------
mksurface s1 f1
mksurface s2 f2
erase s1 s2
for {set i 1} {$i <= ${NbCurv}} {incr i} {
set log [dump c_$i]
set dumptrimres [regexp {Trimmed curve\nParameters : +([-0-9.+eE]+) +([-0-9.+eE]+)} ${log} full U1 U2]
if {${dumptrimres} == 0} {
regexp {Degree +([-0-9.+eE]+), +([-0-9.+eE]+) Poles, +([-0-9.+eE]+)} ${log} full Degree Poles KnotsPoles
puts "Degree=${Degree}"
puts "Poles=${Poles}"
puts "KnotsPoles=${KnotsPoles}"
puts ""
set Knot 1
set exp_string "Knots :\n\n +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
regexp ${exp_string} ${log} full U1 Mult1
set Knot ${KnotsPoles}
set exp_string " +${Knot} : +(\[-0-9.+eE\]+) +(\[-0-9.+eE\]+)"
regexp ${exp_string} ${log} full U2 Mult2
}
puts "U1=${U1}"
puts "U2=${U2}"
if {[expr {$U2 - $U1}] < 1.0e-20} {
puts "Error: Wrong curve's range!"
}
dlog reset
dlog on
xdistcs c_$i s1 ${U1} ${U2} 10
set Log2 [dlog get]
set List2 [split ${Log2} {TD= \t\n}]
set Tolerance 1.0e-7
set Limit_Tol 1.0e-7
set D_good 0.
checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
dlog reset
dlog on
xdistcs c_$i s2 ${U1} ${U2} 10
set Log2 [dlog get]
set List2 [split ${Log2} {TD= \t\n}]
set Tolerance 1.0e-7
set Limit_Tol 1.0e-7
set D_good 0.
checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
}
smallview
fit
set only_screen_axo 1

View File

@@ -0,0 +1,20 @@
puts "==========="
puts "OCC25697"
puts "==========="
puts ""
##########################################################################################
# Regression : Section obtained after command "bsection" in Test Harness is incorrect.
##########################################################################################
restore [locate_data_file bug25697_shell_for_seam.brep] s1
restore [locate_data_file bug25697_prism.brep] p1
bsection result s1 p1 -n2d2
regexp {nb alone Vertices : +([-0-9.+eE]+)} [checksection result] full nb_alone_Vertices
if { ${nb_alone_Vertices} == 2 } {
puts "OK: Good result done by Boolean Operation algorithm"
} else {
puts "Error: Wrong result done by Boolean Operation algorithm"
}
set length 107.503

View File

@@ -0,0 +1,90 @@
puts "=========="
puts "OCC25697"
puts "=========="
puts ""
########################################################################################
# Regression : Section obtained after command "bsection" in Test Harness is incorrect.
########################################################################################
# Check if list of xdistcs-command is valid
proc checkList {List Tolerance D_good Limit_Tol} {
set L1 [llength ${List}]
set L2 10
set L3 5
set N [expr (${L1} - ${L2})/${L3} + 1]
for {set i 1} {${i} <= ${N}} {incr i} {
set j1 [expr ${L2} + (${i}-1)*${L3}]
set j2 [expr ${j1} + 2]
set T [lindex ${List} ${j1}]
set D [lindex ${List} ${j2}]
#puts "i=${i} j1=${j1} j2=${j2} T=${T} D=${D}"
if { [expr abs(${D} - ${D_good})] > ${Tolerance} } {
puts "Error : T=${T} D=${D}"
}
if { ${Tolerance} > ${Limit_Tol} } {
if { [expr abs(${D} - ${D_good})] > ${Limit_Tol}
&& [expr abs(${D} - ${D_good})] <= ${Tolerance} } {
puts "Attention (critical value of tolerance) : T=${T} D=${D}"
}
}
}
}
restore [locate_data_file bug25697_shell_for_seam.brep] b1
restore [locate_data_file bug25697_prism.brep] b2
explode b1 f
copy b1_1 b1
explode b2 f
copy b2_1 b2
#################################
set log [bopcurves b1 b2 -2d1]
#################################
regexp {Tolerance Reached=+([-0-9.+eE]+)\n+([-0-9.+eE]+)} ${log} full Toler NbCurv
set MaxTol 1.e-7
set GoodNbCurv 3
if { ${Toler} > ${MaxTol} } {
puts "Error: Tolerance is too big!"
}
if { ${NbCurv} != ${GoodNbCurv} } {
puts "Error: Curve Number is bad!"
}
#---------------
mksurface s1 b1
mksurface s2 b2
for {set i 1} {$i <= ${NbCurv}} {incr i} {
bounds c_$i u1 u2
dump u1 u2
dlog reset
dlog on
xdistcs c_$i s1 u1 u2 10
set Log2 [dlog get]
set List2 [split ${Log2} {TD= \t\n}]
set Tolerance 1.0e-7
set Limit_Tol 1.0e-7
set D_good 0.
checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
dlog reset
dlog on
xdistcs c_$i s2 u1 u2 10
set Log2 [dlog get]
set List2 [split ${Log2} {TD= \t\n}]
set Tolerance 1.0e-7
set Limit_Tol 1.0e-7
set D_good 0.
checkList ${List2} ${Tolerance} ${D_good} ${Limit_Tol}
}
smallview
fit
set only_screen_axo 1

View File

@@ -0,0 +1,37 @@
puts "============"
puts "OCC24154"
puts "============"
puts ""
######################################################
# Wrong result of CUT operation
######################################################
restore [locate_data_file pl1.brep] pl
restore [locate_data_file selected_holes.brep] hl
set log [bopargcheck pl hl #F]
if{[string compare $log "Shape(s) seem(s) to be valid for BOP.\n"] == 0} {
puts "OK: Source shapes are valid in terms of bopargcheck"
}else{
puts "Error: source shapes are invalid in terms of bopargcheck"
}
bcut result pl hl
set log [bopargcheck result #F]
if{[string compare $log "Shape(s) seem(s) to be valid for BOP.\n"] == 0} {
puts "OK: Source shapes are valid in terms of bopargcheck"
}else{
puts "Error: source shapes are invalid in terms of bopargcheck"
}
# Analysis of "nbshapes res"
set nb_f_good 2
set nb_sh_good 1
set nb_sol_good 0
set nb_compsol_good 0
set nb_compound_good 1