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

0023360: Test cases for command mkoffset produce different results on different versions of OCCT

1. Function QuasiFleche(...) does not call for small edges.
2. Forbid to work with NULL-shapes in OffsetWire::FixHoles(...) function.
3. ProjOnCurve(...) function in Bisector_BisecCC.cxx file returns status (DONE or NOT DONE).
This commit is contained in:
nbv 2013-10-03 14:30:18 +04:00 committed by bugmaster
parent 3cb77da46e
commit 91bb31f35e
9 changed files with 478 additions and 423 deletions

View File

@ -501,7 +501,8 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset,
const Standard_Real Alt) const Standard_Real Alt)
{ {
// Modified by skv - Fri Jul 8 11:21:38 2005 OCC9145 Begin // Modified by skv - Fri Jul 8 11:21:38 2005 OCC9145 Begin
try { try
{
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
myCallGen = Standard_False; myCallGen = Standard_False;
if (KPartCircle(mySpine,Offset,Alt,myShape,myMap,myIsDone)) return; if (KPartCircle(mySpine,Offset,Alt,myShape,myMap,myIsDone)) return;
@ -511,7 +512,8 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset,
TopTools_ListOfShape BadEdges; TopTools_ListOfShape BadEdges;
CheckBadEdges(myWorkSpine,Offset,myBilo,myLink,BadEdges); CheckBadEdges(myWorkSpine,Offset,myBilo,myLink,BadEdges);
if(!BadEdges.IsEmpty()) { if(!BadEdges.IsEmpty())
{
// Modification of myWorkSpine; // Modification of myWorkSpine;
//cout << "Modification of myWorkSpine : " << BadEdges.Extent() << endl; //cout << "Modification of myWorkSpine : " << BadEdges.Extent() << endl;
BRepTools_Substitution aSubst; BRepTools_Substitution aSubst;
@ -526,6 +528,7 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset,
Parameters.Clear(); Parameters.Clear();
Points.Clear(); Points.Clear();
const TopoDS_Shape& anE = it.Value(); const TopoDS_Shape& anE = it.Value();
TopoDS_Vertex Vf, Vl; TopoDS_Vertex Vf, Vl;
TopExp::Vertices(TopoDS::Edge(anE), Vf, Vl); TopExp::Vertices(TopoDS::Edge(anE), Vf, Vl);
@ -537,7 +540,8 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset,
l, Precision::Confusion(), 2); l, Precision::Confusion(), 2);
Standard_Integer NPnts = Points.Length(); Standard_Integer NPnts = Points.Length();
if(NPnts > 2) { if(NPnts > 2)
{
//cout << NPnts << " points " << endl; //cout << NPnts << " points " << endl;
TopoDS_Vertex FV = Vf; TopoDS_Vertex FV = Vf;
TopoDS_Vertex LV; TopoDS_Vertex LV;
@ -554,7 +558,8 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset,
newE = BRepLib_MakeEdge(FV, LV); newE = BRepLib_MakeEdge(FV, LV);
aL.Append(newE); aL.Append(newE);
} }
else { else
{
//cout << " 2 points " << endl; //cout << " 2 points " << endl;
TopoDS_Edge newE = BRepLib_MakeEdge(Vf, Vl); TopoDS_Edge newE = BRepLib_MakeEdge(Vf, Vl);
aL.Append(newE); aL.Append(newE);
@ -597,7 +602,9 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset,
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itmap( wwmap ); TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itmap( wwmap );
for (; itmap.More(); itmap.Next()) for (; itmap.More(); itmap.Next())
aSubst.Substitute( itmap.Key(), itmap.Value() ); aSubst.Substitute( itmap.Key(), itmap.Value() );
aSubst.Build(myWorkSpine); aSubst.Build(myWorkSpine);
if(aSubst.IsCopied(myWorkSpine)) { if(aSubst.IsCopied(myWorkSpine)) {
myWorkSpine = TopoDS::Face(aSubst.Copy(myWorkSpine).First()); myWorkSpine = TopoDS::Face(aSubst.Copy(myWorkSpine).First());
//sprintf(name,"WS1"); //sprintf(name,"WS1");
@ -618,18 +625,16 @@ void BRepFill_OffsetWire::Perform (const Standard_Real Offset,
newLink.Perform(newExp,newBilo); newLink.Perform(newExp,newBilo);
PerformWithBiLo(myWorkSpine,Offset,newBilo,newLink,myJoinType,Alt); PerformWithBiLo(myWorkSpine,Offset,newBilo,newLink,myJoinType,Alt);
myWorkSpine = oldWorkSpain; myWorkSpine = oldWorkSpain;
} }
else { else {
PerformWithBiLo(myWorkSpine,Offset,myBilo,myLink,myJoinType,Alt); PerformWithBiLo(myWorkSpine,Offset,myBilo,myLink,myJoinType,Alt);
} }
} }
else { else
{
PerformWithBiLo(myWorkSpine,Offset,myBilo,myLink,myJoinType,Alt); PerformWithBiLo(myWorkSpine,Offset,myBilo,myLink,myJoinType,Alt);
} }
} }
catch (...)//Every exception was caught. catch (...)//Every exception was caught.
{ {
@ -734,7 +739,8 @@ void BRepFill_OffsetWire::PerformWithBiLo
//******************************** //********************************
// Calculate for a non null offset // Calculate for a non null offset
//******************************** //********************************
if (KPartCircle(mySpine,Offset,Alt,myShape,myMap,myIsDone)) return; if (KPartCircle(mySpine,Offset,Alt,myShape,myMap,myIsDone))
return;
BRep_Builder myBuilder; BRep_Builder myBuilder;
myBuilder.MakeCompound(TopoDS::Compound(myShape)); myBuilder.MakeCompound(TopoDS::Compound(myShape));
@ -1419,6 +1425,10 @@ void BRepFill_OffsetWire::FixHoles()
TopoDS_Wire aWire = TopoDS::Wire( UnclosedWires(i) ); TopoDS_Wire aWire = TopoDS::Wire( UnclosedWires(i) );
TopoDS_Vertex V1, V2; TopoDS_Vertex V1, V2;
TopExp::Vertices( aWire, V1, V2 ); TopExp::Vertices( aWire, V1, V2 );
if(V1.IsNull() || V2.IsNull())
Standard_Failure::Raise("BRepFill_OffsetWire::FixHoles(): Wrong wire.");
gp_Pnt P1, P2; gp_Pnt P1, P2;
P1 = BRep_Tool::Pnt(V1); P1 = BRep_Tool::Pnt(V1);
P2 = BRep_Tool::Pnt(V2); P2 = BRep_Tool::Pnt(V2);
@ -2335,6 +2345,12 @@ static Standard_Boolean PerformCurve (TColStd_SequenceOfReal& Parameters,
Points.Append(Pdeb); Points.Append(Pdeb);
C.D1(UU2,Pfin,Dfin); C.D1(UU2,Pfin,Dfin);
const Standard_Real aDelta = UU2 - UU1;
const Standard_Real aDist = Pdeb.Distance(Pfin);
if((aDelta/aDist) > 5.0e-14)
{
QuasiFleche(C,Deflection*Deflection, QuasiFleche(C,Deflection*Deflection,
UU1,Pdeb, UU1,Pdeb,
Ddeb, Ddeb,
@ -2343,6 +2359,8 @@ static Standard_Boolean PerformCurve (TColStd_SequenceOfReal& Parameters,
Nbmin, Nbmin,
EPSILON*EPSILON, EPSILON*EPSILON,
Parameters,Points); Parameters,Points);
}
return Standard_True; return Standard_True;
} }
//======================================================================= //=======================================================================

View File

@ -50,8 +50,9 @@
#include <Standard_NotImplemented.hxx> #include <Standard_NotImplemented.hxx>
static Standard_Real ProjOnCurve (const gp_Pnt2d& P, static Standard_Boolean ProjOnCurve (const gp_Pnt2d& P,
const Handle(Geom2d_Curve)& C); const Handle(Geom2d_Curve)& C,
Standard_Real& theParam);
static Standard_Real Curvature (const Handle(Geom2d_Curve)& C, static Standard_Real Curvature (const Handle(Geom2d_Curve)& C,
Standard_Real U, Standard_Real U,
@ -125,9 +126,15 @@ void Bisector_BisecCC::Perform(const Handle(Geom2d_Curve)& Cu1,
//--------------------------------------------- //---------------------------------------------
// Calculate first point of the polygon. // Calculate first point of the polygon.
//--------------------------------------------- //---------------------------------------------
U = ProjOnCurve (Origin,curve1); Standard_Boolean isProjDone = ProjOnCurve (Origin,curve1, U);
P = ValueByInt (U,UC1,UC2,Dist); P = ValueByInt (U,UC1,UC2,Dist);
if(!isProjDone)
{
isEmpty = Standard_True;
return;
}
if (Dist < Precision::Infinite()) { if (Dist < Precision::Infinite()) {
//---------------------------------------------------- //----------------------------------------------------
// the parameter of the origin point gives a point // the parameter of the origin point gives a point
@ -1409,9 +1416,11 @@ Standard_Real Bisector_BisecCC::Parameter(const gp_Pnt2d& P) const
else if (P.IsEqual(Value(LastParameter()),Precision::Confusion())) { else if (P.IsEqual(Value(LastParameter()),Precision::Confusion())) {
UOnCurve = LastParameter(); UOnCurve = LastParameter();
} }
else { else
UOnCurve = ProjOnCurve(P,curve1); {
ProjOnCurve(P, curve1, UOnCurve);
} }
return UOnCurve; return UOnCurve;
} }
@ -1623,42 +1632,56 @@ Standard_Real Bisector_BisecCC::SearchBound (const Standard_Real U1,
//function : ProjOnCurve //function : ProjOnCurve
// purpose : // purpose :
//============================================================================= //=============================================================================
static Standard_Real ProjOnCurve (const gp_Pnt2d& P, static Standard_Boolean ProjOnCurve (const gp_Pnt2d& P,
const Handle(Geom2d_Curve)& C) const Handle(Geom2d_Curve)& C,
Standard_Real& theParam)
{ {
Standard_Real UOnCurve =0.; //Standard_Real UOnCurve =0.;
theParam = 0.0;
gp_Pnt2d PF,PL; gp_Pnt2d PF,PL;
gp_Vec2d TF,TL; gp_Vec2d TF,TL;
C->D1(C->FirstParameter(),PF,TF); C->D1(C->FirstParameter(),PF,TF);
C->D1(C->LastParameter() ,PL,TL); C->D1(C->LastParameter() ,PL,TL);
if (P.IsEqual(PF ,Precision::Confusion())) { if (P.IsEqual(PF ,Precision::Confusion()))
return C->FirstParameter(); {
theParam = C->FirstParameter();
return Standard_True;
} }
if (P.IsEqual(PL ,Precision::Confusion())) {
return C->LastParameter(); if (P.IsEqual(PL ,Precision::Confusion()))
{
theParam = C->LastParameter();
return Standard_True;
} }
gp_Vec2d PPF(PF.X() - P.X(), PF.Y() - P.Y()); gp_Vec2d PPF(PF.X() - P.X(), PF.Y() - P.Y());
TF.Normalize(); TF.Normalize();
if ( Abs (PPF.Dot(TF)) < Precision::Confusion()) {
return C->FirstParameter(); if ( Abs (PPF.Dot(TF)) < Precision::Confusion())
{
theParam = C->FirstParameter();
return Standard_True;
} }
gp_Vec2d PPL (PL.X() - P.X(), PL.Y() - P.Y()); gp_Vec2d PPL (PL.X() - P.X(), PL.Y() - P.Y());
TL.Normalize(); TL.Normalize();
if ( Abs (PPL.Dot(TL)) < Precision::Confusion()) { if ( Abs (PPL.Dot(TL)) < Precision::Confusion())
return C->LastParameter(); {
theParam = C->LastParameter();
return Standard_True;
} }
Geom2dAPI_ProjectPointOnCurve Proj(P,C, Geom2dAPI_ProjectPointOnCurve Proj(P,C,
C->FirstParameter(), C->FirstParameter(),
C->LastParameter()); C->LastParameter());
if (Proj.NbPoints() > 0) { if (Proj.NbPoints() > 0) {
UOnCurve = Proj.LowerDistanceParameter(); theParam = Proj.LowerDistanceParameter();
} }
else { else {
Standard_OutOfRange::Raise(); return Standard_False;
} }
return UOnCurve;
return Standard_True;
} }
//============================================================================= //=============================================================================

View File

@ -40,5 +40,13 @@ checkshape res5
renamevar res5 result renamevar res5 result
set square 1.21497e+7 set OCC62_square 1.23063e+7
puts "The expected square is ${OCC62_square}"
set sq_persent 0.03
regexp {Mass +: +([-0-9.+eE]+)} [sprops result] full m
if { (${OCC62_square} != 0 && [expr abs(${OCC62_square} - $m)/${OCC62_square}] > ${sq_persent}) || (${OCC62_square} == 0 && $m != 0) } {
puts "Error : The square of result shape is $m"
}
set 2dviewer 0 set 2dviewer 0

View File

@ -1,8 +1,10 @@
puts "TODO ?OCC23068 ALL: TEST INCOMPLETE" #puts "TODO ?OCC23068 ALL: TEST INCOMPLETE"
puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO OCC23068 ALL: Error : The offset cannot be built."
puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO OCC23068 ALL: An exception was caught"
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" #puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO ?OCC23068 ALL: Error : result is not a topological shape!!!" #puts "TODO ?OCC23068 ALL: Error : result is not a topological shape!!!"
puts "TODO OCC23068 ALL: Error: Offset is not done."
restore [locate_data_file offset_wire_074.brep] s restore [locate_data_file offset_wire_074.brep] s
set length 0 set length 0

View File

@ -1,7 +1,7 @@
puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." #puts "TODO ?OCC23068 ALL: Error : The offset cannot be built."
puts "TODO ?OCC23068 ALL: An exception was caught" #puts "TODO ?OCC23068 ALL: An exception was caught"
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" #puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO ?OCC23748 ALL: Error: Offset is not done." #puts "TODO ?OCC23748 ALL: Error: Offset is not done."
restore [locate_data_file offset_wire_075.brep] s restore [locate_data_file offset_wire_075.brep] s

View File

@ -1,8 +1,10 @@
puts "TODO ?OCC23068 ALL: TEST INCOMPLETE" #puts "TODO ?OCC23068 ALL: TEST INCOMPLETE"
puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO OCC23068 ALL: Error : The offset cannot be built."
puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO OCC23068 ALL: An exception was caught"
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" #puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO ?OCC23068 ALL: Error : result is not a topological shape!!!" #puts "TODO ?OCC23068 ALL: Error : result is not a topological shape!!!"
puts "TODO OCC23068 ALL: Error: Offset is not done."
restore [locate_data_file offset_wire_074.brep] s restore [locate_data_file offset_wire_074.brep] s
set length 0 set length 0

View File

@ -1,7 +1,7 @@
puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." #puts "TODO ?OCC23068 ALL: Error : The offset cannot be built."
puts "TODO ?OCC23068 ALL: An exception was caught" #puts "TODO ?OCC23068 ALL: An exception was caught"
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" #puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO ?OCC23748 ALL: Error: Offset is not done." #puts "TODO ?OCC23748 ALL: Error: Offset is not done."
restore [locate_data_file offset_wire_075.brep] s restore [locate_data_file offset_wire_075.brep] s

View File

@ -1,8 +1,10 @@
puts "TODO ?OCC23068 ALL: TEST INCOMPLETE" #puts "TODO ?OCC23068 ALL: TEST INCOMPLETE"
puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." puts "TODO OCC23068 ALL: Error : The offset cannot be built."
puts "TODO ?OCC23068 ALL: An exception was caught" puts "TODO OCC23068 ALL: An exception was caught"
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" #puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO ?OCC23068 ALL: Error : result is not a topological shape!!!" #puts "TODO ?OCC23068 ALL: Error : result is not a topological shape!!!"
puts "TODO OCC23068 ALL: Error: Offset is not done."
restore [locate_data_file offset_wire_074.brep] s restore [locate_data_file offset_wire_074.brep] s
set length 0 set length 0

View File

@ -1,7 +1,7 @@
puts "TODO ?OCC23068 ALL: Error : The offset cannot be built." #puts "TODO ?OCC23068 ALL: Error : The offset cannot be built."
puts "TODO ?OCC23068 ALL: An exception was caught" #puts "TODO ?OCC23068 ALL: An exception was caught"
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*" #puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO ?OCC23748 ALL: Error: Offset is not done." #puts "TODO ?OCC23748 ALL: Error: Offset is not done."
restore [locate_data_file offset_wire_075.brep] s restore [locate_data_file offset_wire_075.brep] s