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

View File

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

View File

@ -40,5 +40,13 @@ checkshape res5
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

View File

@ -1,8 +1,10 @@
puts "TODO ?OCC23068 ALL: TEST INCOMPLETE"
puts "TODO ?OCC23068 ALL: Error : The offset cannot be built."
puts "TODO ?OCC23068 ALL: An exception was caught"
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO ?OCC23068 ALL: Error : result is not a topological shape!!!"
#puts "TODO ?OCC23068 ALL: TEST INCOMPLETE"
puts "TODO OCC23068 ALL: Error : The offset cannot be built."
puts "TODO OCC23068 ALL: An exception was caught"
#puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
#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
set length 0

View File

@ -1,7 +1,7 @@
puts "TODO ?OCC23068 ALL: Error : The offset cannot be built."
puts "TODO ?OCC23068 ALL: An exception was caught"
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO ?OCC23748 ALL: Error: Offset is not done."
#puts "TODO ?OCC23068 ALL: Error : The offset cannot be built."
#puts "TODO ?OCC23068 ALL: An exception was caught"
#puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
#puts "TODO ?OCC23748 ALL: Error: Offset is not done."
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: Error : The offset cannot be built."
puts "TODO ?OCC23068 ALL: An exception was caught"
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO ?OCC23068 ALL: Error : result is not a topological shape!!!"
#puts "TODO ?OCC23068 ALL: TEST INCOMPLETE"
puts "TODO OCC23068 ALL: Error : The offset cannot be built."
puts "TODO OCC23068 ALL: An exception was caught"
#puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
#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
set length 0

View File

@ -1,7 +1,7 @@
puts "TODO ?OCC23068 ALL: Error : The offset cannot be built."
puts "TODO ?OCC23068 ALL: An exception was caught"
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO ?OCC23748 ALL: Error: Offset is not done."
#puts "TODO ?OCC23068 ALL: Error : The offset cannot be built."
#puts "TODO ?OCC23068 ALL: An exception was caught"
#puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
#puts "TODO ?OCC23748 ALL: Error: Offset is not done."
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: Error : The offset cannot be built."
puts "TODO ?OCC23068 ALL: An exception was caught"
puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
puts "TODO ?OCC23068 ALL: Error : result is not a topological shape!!!"
#puts "TODO ?OCC23068 ALL: TEST INCOMPLETE"
puts "TODO OCC23068 ALL: Error : The offset cannot be built."
puts "TODO OCC23068 ALL: An exception was caught"
#puts "TODO ?OCC23068 ALL: \\*\\* Exception \\*\\*.*"
#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
set length 0

View File

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