mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024390: Sewing produces the result with huge tolerance
Test cases for issue CR24390
This commit is contained in:
parent
2bc29cdf9e
commit
0221b126ee
@ -738,10 +738,11 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
|||||||
if (whichSec == 1) itf2.Initialize(listFacesLast);
|
if (whichSec == 1) itf2.Initialize(listFacesLast);
|
||||||
else itf2.Initialize(listFacesFirst);
|
else itf2.Initialize(listFacesFirst);
|
||||||
Standard_Boolean isResEdge = Standard_False;
|
Standard_Boolean isResEdge = Standard_False;
|
||||||
|
TopoDS_Face fac2;
|
||||||
for (; itf2.More(); itf2.Next()) {
|
for (; itf2.More(); itf2.Next()) {
|
||||||
Handle(Geom2d_Curve) c2d2, c2d21;
|
Handle(Geom2d_Curve) c2d2, c2d21;
|
||||||
Standard_Real firstOld, lastOld;
|
Standard_Real firstOld, lastOld;
|
||||||
const TopoDS_Face& fac2 = TopoDS::Face(itf2.Value());
|
fac2 = TopoDS::Face(itf2.Value());
|
||||||
|
|
||||||
surf2 = BRep_Tool::Surface(fac2, loc2);
|
surf2 = BRep_Tool::Surface(fac2, loc2);
|
||||||
Standard_Boolean isSeam2 = ((IsUClosedSurface(surf2,edge2,loc2) || IsVClosedSurface(surf2,edge2,loc2)) &&
|
Standard_Boolean isSeam2 = ((IsUClosedSurface(surf2,edge2,loc2) || IsVClosedSurface(surf2,edge2,loc2)) &&
|
||||||
@ -899,6 +900,7 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
|||||||
{
|
{
|
||||||
edge = s_edge;
|
edge = s_edge;
|
||||||
whichSec = whichSecn;
|
whichSec = whichSecn;
|
||||||
|
tolReached = tolReached_2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,30 +909,42 @@ TopoDS_Edge BRepBuilderAPI_Sewing::SameParameterEdge(const TopoDS_Edge& edgeFirs
|
|||||||
GeomAdaptor_Curve c3dAdapt(c3d);
|
GeomAdaptor_Curve c3dAdapt(c3d);
|
||||||
|
|
||||||
// Discretize edge curve
|
// Discretize edge curve
|
||||||
Standard_Integer i, j, nbp = 15;
|
Standard_Integer i, j, nbp = 23;
|
||||||
Standard_Real deltaT = (last3d - first3d) / (nbp + 1);
|
Standard_Real deltaT = (last3d - first3d) / (nbp + 1);
|
||||||
TColgp_Array1OfPnt c3dpnt(1,nbp);
|
TColgp_Array1OfPnt c3dpnt(1,nbp);
|
||||||
for (i = 1; i <= nbp; i++) c3dpnt(i) = c3dAdapt.Value(first3d + i*deltaT);
|
for (i = 1; i <= nbp; i++)
|
||||||
|
c3dpnt(i) = c3dAdapt.Value(first3d + i*deltaT);
|
||||||
|
|
||||||
Standard_Real u, v, dist, maxTol = -1.0;
|
Standard_Real dist = 0., maxTol = -1.0;
|
||||||
Standard_Boolean more = Standard_True;
|
Standard_Boolean more = Standard_True;
|
||||||
|
Standard_Boolean useFace = Standard_False;
|
||||||
|
|
||||||
for (j = 1; more; j++) {
|
for (j = 1; more; j++) {
|
||||||
Handle(Geom2d_Curve) c2d2;
|
Handle(Geom2d_Curve) c2d2;
|
||||||
BRep_Tool::CurveOnSurface(edge, c2d2, surf2, loc2, first, last, j);
|
BRep_Tool::CurveOnSurface(edge, c2d2, surf2, loc2, first, last, j);
|
||||||
|
|
||||||
more = !c2d2.IsNull();
|
more = !c2d2.IsNull();
|
||||||
if (more) {
|
if (more) {
|
||||||
|
Handle(Geom_Surface) aS = surf2;
|
||||||
|
if(!loc2.IsIdentity())
|
||||||
|
aS = Handle(Geom_Surface)::DownCast(surf2->Transformed ( loc2 ));
|
||||||
|
|
||||||
|
Standard_Real dist2 = 0.;
|
||||||
deltaT = (last - first) / (nbp + 1);
|
deltaT = (last - first) / (nbp + 1);
|
||||||
for (i = 1; i <= nbp; i++) {
|
for (i = 1; i <= nbp; i++) {
|
||||||
c2d2->Value(first + i*deltaT).Coord(u,v);
|
gp_Pnt2d aP2d = c2d2->Value(first + i*deltaT);
|
||||||
dist = surf2->Value(u,v).Distance(c3dpnt(i));
|
gp_Pnt aP2(0.,0.,0.);
|
||||||
if (dist > maxTol) maxTol = dist;
|
aS->D0(aP2d.X(),aP2d.Y(), aP2);
|
||||||
|
gp_Pnt aP1 = c3dpnt(i);
|
||||||
|
dist = aP2.SquareDistance(aP1);
|
||||||
|
if (dist > dist2)
|
||||||
|
dist2 = dist;
|
||||||
|
}
|
||||||
|
maxTol = Max(sqrt(dist2), Precision::Confusion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if(maxTol >= 0. && maxTol < tolReached)
|
||||||
|
aBuilder.UpdateEdge(edge, maxTol);
|
||||||
if (maxTol >= 0.) aBuilder.UpdateEdge(edge, maxTol);
|
|
||||||
aBuilder.SameParameter(edge,Standard_True);
|
aBuilder.SameParameter(edge,Standard_True);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
44
tests/bugs/modalg_5/bug24390_1
Executable file
44
tests/bugs/modalg_5/bug24390_1
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
puts "========================"
|
||||||
|
puts "OCC24390"
|
||||||
|
puts "========================"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Sewing produces the result with huge tolerance
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
pload XSDRAW
|
||||||
|
|
||||||
|
restore [locate_data_file bug24390_face_0.brep] f1
|
||||||
|
restore [locate_data_file bug24390_face_1.brep] f2
|
||||||
|
restore [locate_data_file bug24390_face_2.brep] f3
|
||||||
|
restore [locate_data_file bug24390_face_3.brep] f4
|
||||||
|
restore [locate_data_file bug24390_face_4.brep] f5
|
||||||
|
restore [locate_data_file bug24390_face_5.brep] f6
|
||||||
|
|
||||||
|
sewing result f1 f2 f3 f4 f5 f6
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
|
||||||
|
set tolmax_f [tolmax f1]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${tolmax_f} full CMP_TOL
|
||||||
|
|
||||||
|
set face_list {f2 f3 f4 f5 f6}
|
||||||
|
foreach f ${face_list} {
|
||||||
|
set tolmax_f [tolmax ${f}]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${tolmax_f} full FaceMaxTolerance
|
||||||
|
if { ${FaceMaxTolerance} > ${CMP_TOL} } {
|
||||||
|
set CMP_TOL ${FaceMaxTolerance}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set CMP_TOL [expr 5. * ${CMP_TOL}]
|
||||||
|
puts "CMP_TOL=${CMP_TOL}"
|
||||||
|
|
||||||
|
set tolmaxres [tolmax result]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${tolmaxres} full MaxTolerance
|
||||||
|
puts "MaxTolerance=${MaxTolerance}"
|
||||||
|
if { ${MaxTolerance} > ${CMP_TOL} } {
|
||||||
|
puts "Error: invalid tolerance"
|
||||||
|
}
|
||||||
|
|
||||||
|
set 2dviewer 1
|
40
tests/bugs/modalg_5/bug24390_2
Executable file
40
tests/bugs/modalg_5/bug24390_2
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
puts "========================"
|
||||||
|
puts "OCC24390"
|
||||||
|
puts "========================"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Sewing produces the result with huge tolerance
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
pload XSDRAW
|
||||||
|
|
||||||
|
restore [locate_data_file bug24390_face1.brep] f1
|
||||||
|
restore [locate_data_file bug24390_face2.brep] f2
|
||||||
|
|
||||||
|
sewing result f1 f2
|
||||||
|
|
||||||
|
checkshape result
|
||||||
|
|
||||||
|
set tolmax_f [tolmax f1]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${tolmax_f} full CMP_TOL
|
||||||
|
|
||||||
|
set face_list {f2}
|
||||||
|
foreach f ${face_list} {
|
||||||
|
set tolmax_f [tolmax ${f}]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${tolmax_f} full FaceMaxTolerance
|
||||||
|
if { ${FaceMaxTolerance} > ${CMP_TOL} } {
|
||||||
|
set CMP_TOL ${FaceMaxTolerance}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set CMP_TOL [expr 5. * ${CMP_TOL}]
|
||||||
|
puts "CMP_TOL=${CMP_TOL}"
|
||||||
|
|
||||||
|
set tolmaxres [tolmax result]
|
||||||
|
regexp {max tol = ([-0-9.+eE]+)} ${tolmaxres} full MaxTolerance
|
||||||
|
puts "MaxTolerance=${MaxTolerance}"
|
||||||
|
if { ${MaxTolerance} > ${CMP_TOL} } {
|
||||||
|
puts "Error: invalid tolerance"
|
||||||
|
}
|
||||||
|
|
||||||
|
set 2dviewer 1
|
Loading…
x
Reference in New Issue
Block a user