mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0024174: [regression] BRepBuilderAPI_Sewing returns result with very high tolerance
Fix for bug 0024174: [regression] BRepBuilderAPI_Sewing returns result with very high tolerance Test script for CR24174 Test cases for issue CR24174 Small correction of test cases for issue CR24174
This commit is contained in:
parent
1665a85a84
commit
4798010403
@ -18,6 +18,7 @@
|
|||||||
// purpose or non-infringement. Please see the License for the specific terms
|
// purpose or non-infringement. Please see the License for the specific terms
|
||||||
// and conditions governing the rights and limitations under the License.
|
// and conditions governing the rights and limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
// dcl CCI60011 : Correction of degeneratedSection
|
// dcl CCI60011 : Correction of degeneratedSection
|
||||||
// Improvement of SameParameter Edge to treat case of failure in BRepLib::SameParameter
|
// Improvement of SameParameter Edge to treat case of failure in BRepLib::SameParameter
|
||||||
// dcl Thu Aug 20 09:24:49 1998
|
// dcl Thu Aug 20 09:24:49 1998
|
||||||
@ -729,6 +730,7 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
|||||||
// Retrieve second PCurves
|
// Retrieve second PCurves
|
||||||
TopLoc_Location loc2;
|
TopLoc_Location loc2;
|
||||||
Handle(Geom_Surface) surf2;
|
Handle(Geom_Surface) surf2;
|
||||||
|
|
||||||
//Handle(Geom2d_Curve) c2d2, c2d21;
|
//Handle(Geom2d_Curve) c2d2, c2d21;
|
||||||
// Standard_Real firstOld, lastOld;
|
// Standard_Real firstOld, lastOld;
|
||||||
|
|
||||||
@ -796,6 +798,7 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
|||||||
|
|
||||||
TopLoc_Location loc1;
|
TopLoc_Location loc1;
|
||||||
Handle(Geom_Surface) surf1 = BRep_Tool::Surface(fac1, loc1);
|
Handle(Geom_Surface) surf1 = BRep_Tool::Surface(fac1, loc1);
|
||||||
|
|
||||||
Standard_Real first2d, last2d;
|
Standard_Real first2d, last2d;
|
||||||
Standard_Boolean isSeam1 = ((IsUClosedSurface(surf1,edge1,loc1) || IsVClosedSurface(surf1,edge1,loc1)) &&
|
Standard_Boolean isSeam1 = ((IsUClosedSurface(surf1,edge1,loc1) || IsVClosedSurface(surf1,edge1,loc1)) &&
|
||||||
BRep_Tool::IsClosed(TopoDS::Edge(edge1),fac1));
|
BRep_Tool::IsClosed(TopoDS::Edge(edge1),fac1));
|
||||||
@ -869,28 +872,37 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isResEdge)
|
Standard_Real tolReached = Precision::Infinite();
|
||||||
// Try to make the edge sameparameter
|
Standard_Boolean isSamePar = Standard_False;
|
||||||
|
if( isResEdge)
|
||||||
|
{
|
||||||
SameParameter(edge);
|
SameParameter(edge);
|
||||||
|
if( BRep_Tool::SameParameter(edge))
|
||||||
|
{
|
||||||
|
isSamePar = Standard_True;
|
||||||
|
tolReached = BRep_Tool::Tolerance(edge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Standard_Real tolReached = BRep_Tool::Tolerance(edge);
|
|
||||||
//if (!BRep_Tool::SameParameter(edge)) return edge; //gka ????????
|
|
||||||
|
|
||||||
if (firstCall && (!BRep_Tool::SameParameter(edge) || !isResEdge)) {
|
if (firstCall && ( !isResEdge || !isSamePar || tolReached > myTolerance)) {
|
||||||
Standard_Integer whichSecn = whichSec;
|
Standard_Integer whichSecn = whichSec;
|
||||||
// Try to merge on the second section
|
// Try to merge on the second section
|
||||||
Standard_Boolean second_ok = Standard_True;
|
Standard_Boolean second_ok = Standard_False;
|
||||||
TopoDS_Edge s_edge = SameParameterEdge(edgeFirst,edgeLast,listFacesFirst,listFacesLast,
|
TopoDS_Edge s_edge = SameParameterEdge(edgeFirst,edgeLast,listFacesFirst,listFacesLast,
|
||||||
secForward,whichSecn,Standard_False);
|
secForward,whichSecn,Standard_False);
|
||||||
//if (s_edge.IsNull()) return s_edge; // gka version for free edges
|
if( !s_edge.IsNull())
|
||||||
if (s_edge.IsNull()) second_ok = Standard_False;
|
{
|
||||||
else if (!BRep_Tool::SameParameter(s_edge)) second_ok = Standard_False;
|
Standard_Real tolReached_2 = BRep_Tool::Tolerance(s_edge);
|
||||||
else {
|
second_ok = ( BRep_Tool::SameParameter(s_edge) && tolReached_2 < tolReached );
|
||||||
edge = s_edge;
|
if( second_ok)
|
||||||
whichSec = whichSecn;
|
{
|
||||||
|
edge = s_edge;
|
||||||
|
whichSec = whichSecn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!second_ok) {
|
if (!second_ok && !edge.IsNull()) {
|
||||||
|
|
||||||
GeomAdaptor_Curve c3dAdapt(c3d);
|
GeomAdaptor_Curve c3dAdapt(c3d);
|
||||||
|
|
||||||
@ -4241,8 +4253,10 @@ void BRepBuilderAPI_Sewing::ProjectPointsOnCurve(const TColgp_Array1OfPnt& arrPn
|
|||||||
Extrema_ExtPC locProj;
|
Extrema_ExtPC locProj;
|
||||||
locProj.Initialize(GAC, first, last);
|
locProj.Initialize(GAC, first, last);
|
||||||
gp_Pnt pfirst = GAC.Value(first), plast = GAC.Value(last);
|
gp_Pnt pfirst = GAC.Value(first), plast = GAC.Value(last);
|
||||||
|
Standard_Integer find = 1;//(isConsiderEnds ? 1 : 2);
|
||||||
|
Standard_Integer lind = arrPnt.Length();//(isConsiderEnds ? arrPnt.Length() : arrPnt.Length() -1);
|
||||||
|
|
||||||
for (Standard_Integer i1 = 1; i1 <= arrPnt.Length(); i1++) {
|
for (Standard_Integer i1 = find; i1 <= lind ; i1++) {
|
||||||
gp_Pnt pt = arrPnt(i1);
|
gp_Pnt pt = arrPnt(i1);
|
||||||
Standard_Real worktol = myTolerance;
|
Standard_Real worktol = myTolerance;
|
||||||
Standard_Real distF2 = pfirst.SquareDistance(pt);
|
Standard_Real distF2 = pfirst.SquareDistance(pt);
|
||||||
@ -4253,7 +4267,7 @@ void BRepBuilderAPI_Sewing::ProjectPointsOnCurve(const TColgp_Array1OfPnt& arrPn
|
|||||||
// Project current point on curve
|
// Project current point on curve
|
||||||
locProj.Perform(pt);
|
locProj.Perform(pt);
|
||||||
if (locProj.IsDone() && locProj.NbExt() > 0) {
|
if (locProj.IsDone() && locProj.NbExt() > 0) {
|
||||||
Standard_Real dist2Min = Min(distF2,distL2);
|
Standard_Real dist2Min = (isConsiderEnds || i1 == find || i1 == lind ? Min(distF2,distL2) : Precision::Infinite());
|
||||||
Standard_Integer ind, indMin = 0;
|
Standard_Integer ind, indMin = 0;
|
||||||
for (ind = 1; ind <= locProj.NbExt(); ind++) {
|
for (ind = 1; ind <= locProj.NbExt(); ind++) {
|
||||||
Standard_Real dProj2 = locProj.SquareDistance(ind);
|
Standard_Real dProj2 = locProj.SquareDistance(ind);
|
||||||
|
47
tests/bugs/modalg_5/bug24174_1
Normal file
47
tests/bugs/modalg_5/bug24174_1
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
puts "========================"
|
||||||
|
puts "OCC24174"
|
||||||
|
puts "========================"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# [regression] BRepBuilderAPI_Sewing returns result with very high tolerance
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
pload XSDRAW
|
||||||
|
|
||||||
|
restore [locate_data_file bug24174_Comp1.brep] a
|
||||||
|
|
||||||
|
explode a
|
||||||
|
sewing result 0.1 a_1 a_2
|
||||||
|
|
||||||
|
# 0
|
||||||
|
set log_1 [tolmax a_1]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${log_1} full MaxTolerance_a_1
|
||||||
|
set log_2 [tolmax a_2]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${log_2} full MaxTolerance_a_2
|
||||||
|
set CMP_TOL ${MaxTolerance_a_1}
|
||||||
|
if { ${MaxTolerance_a_2} > ${CMP_TOL} } {
|
||||||
|
set CMP_TOL ${MaxTolerance_a_2}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 1
|
||||||
|
checkshape result
|
||||||
|
|
||||||
|
# 2
|
||||||
|
set log_3 [tolmax result]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${log_3} full MaxTolerance_result
|
||||||
|
if { ${MaxTolerance_result} > ${CMP_TOL} } {
|
||||||
|
puts "Error: invalid tolerance"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 3
|
||||||
|
freebounds ${result} 0
|
||||||
|
set s [explode result_c e]
|
||||||
|
|
||||||
|
set Number [ llength ${s} ]
|
||||||
|
puts "Number of free edges is ${Number}"
|
||||||
|
set Number_Free_Edges 12
|
||||||
|
if { ${Number} != ${Number_Free_Edges} } {
|
||||||
|
puts "Error : Number of free edges is ${Number}"
|
||||||
|
}
|
||||||
|
|
||||||
|
set 2dviewer 1
|
41
tests/bugs/modalg_5/bug24174_2
Normal file
41
tests/bugs/modalg_5/bug24174_2
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
puts "========================"
|
||||||
|
puts "OCC24174"
|
||||||
|
puts "========================"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# [regression] BRepBuilderAPI_Sewing returns result with very high tolerance
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
pload XSDRAW
|
||||||
|
|
||||||
|
restore [locate_data_file bug24174_stitch.brep] a
|
||||||
|
|
||||||
|
sewing result 0.1 a
|
||||||
|
|
||||||
|
# 0
|
||||||
|
set log_1 [tolmax a]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${log_1} full MaxTolerance_a
|
||||||
|
set CMP_TOL ${MaxTolerance_a}
|
||||||
|
|
||||||
|
# 1
|
||||||
|
checkshape result
|
||||||
|
|
||||||
|
# 2
|
||||||
|
set log_2 [tolmax result]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${log_2} full MaxTolerance_result
|
||||||
|
if { ${MaxTolerance_result} > ${CMP_TOL} } {
|
||||||
|
puts "Error: invalid tolerance"
|
||||||
|
}
|
||||||
|
|
||||||
|
# 3
|
||||||
|
freebounds $result 0
|
||||||
|
set s [explode result_c e]
|
||||||
|
|
||||||
|
set Number [ llength ${s} ]
|
||||||
|
puts "Number of free edges is ${Number}"
|
||||||
|
set Number_Free_Edges 9
|
||||||
|
if { ${Number} != ${Number_Free_Edges} } {
|
||||||
|
puts "Error : Number of free edges is ${Number}"
|
||||||
|
}
|
||||||
|
|
||||||
|
set 2dviewer 1
|
@ -1,2 +1,2 @@
|
|||||||
restore [locate_data_file CIN902_intcqhmp.rle] a
|
restore [locate_data_file CIN902_intcqhmp.rle] a
|
||||||
set nb_f 6
|
set nb_f 4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user