mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0027134: Offset algorithm produces an invalid shape from a cone
Correction of test case for issue CR27134
This commit is contained in:
parent
5e9548e77b
commit
cc9f459173
@ -2667,7 +2667,7 @@ void BRepOffset_MakeOffset::CorrectConicalFaces()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NewEdges.Append(FirstEdge);
|
NewEdges.Append(FirstEdge.Oriented(TopAbs_FORWARD));
|
||||||
TopoDS_Vertex Vf1, CurVertex;
|
TopoDS_Vertex Vf1, CurVertex;
|
||||||
TopExp::Vertices(FirstEdge, Vf1, CurVertex);
|
TopExp::Vertices(FirstEdge, Vf1, CurVertex);
|
||||||
itl.Initialize(EdgesOfWire);
|
itl.Initialize(EdgesOfWire);
|
||||||
@ -2678,7 +2678,7 @@ void BRepOffset_MakeOffset::CorrectConicalFaces()
|
|||||||
TopExp::Vertices(anEdge, V1, V2);
|
TopExp::Vertices(anEdge, V1, V2);
|
||||||
if (V1.IsSame(CurVertex) || V2.IsSame(CurVertex))
|
if (V1.IsSame(CurVertex) || V2.IsSame(CurVertex))
|
||||||
{
|
{
|
||||||
NewEdges.Append(anEdge);
|
NewEdges.Append(anEdge.Oriented(TopAbs_FORWARD));
|
||||||
CurVertex = (V1.IsSame(CurVertex))? V2 : V1;
|
CurVertex = (V1.IsSame(CurVertex))? V2 : V1;
|
||||||
EdgesOfWire.Remove(itl);
|
EdgesOfWire.Remove(itl);
|
||||||
}
|
}
|
||||||
@ -2696,30 +2696,32 @@ void BRepOffset_MakeOffset::CorrectConicalFaces()
|
|||||||
Vfirst = -M_PI/2.; Vlast = p2d1.Y();
|
Vfirst = -M_PI/2.; Vlast = p2d1.Y();
|
||||||
}
|
}
|
||||||
TopoDS_Face NewSphericalFace = BRepLib_MakeFace(aSphSurf, Ufirst, Ulast, Vfirst, Vlast, Precision::Confusion());
|
TopoDS_Face NewSphericalFace = BRepLib_MakeFace(aSphSurf, Ufirst, Ulast, Vfirst, Vlast, Precision::Confusion());
|
||||||
TopoDS_Edge OldEdge;
|
TopoDS_Edge OldEdge, DegEdge;
|
||||||
|
for (Explo.Init(NewSphericalFace, TopAbs_EDGE); Explo.More(); Explo.Next())
|
||||||
|
{
|
||||||
|
DegEdge = TopoDS::Edge(Explo.Current());
|
||||||
|
if (BRep_Tool::Degenerated(DegEdge))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
TopoDS_Vertex DegVertex = TopExp::FirstVertex(DegEdge);
|
||||||
for (Explo.Init(NewSphericalFace, TopAbs_EDGE); Explo.More(); Explo.Next())
|
for (Explo.Init(NewSphericalFace, TopAbs_EDGE); Explo.More(); Explo.Next())
|
||||||
{
|
{
|
||||||
OldEdge = TopoDS::Edge(Explo.Current());
|
OldEdge = TopoDS::Edge(Explo.Current());
|
||||||
if (!BRep_Tool::Degenerated(OldEdge))
|
TopoDS_Vertex V1, V2;
|
||||||
{
|
TopExp::Vertices(OldEdge, V1, V2);
|
||||||
BRepAdaptor_Curve2d BAc2d(OldEdge, NewSphericalFace);
|
if (!V1.IsSame(DegVertex) && !V2.IsSame(DegVertex))
|
||||||
p2d1 = BAc2d.Value(BAc2d.FirstParameter());
|
break;
|
||||||
p2d2 = BAc2d.Value(BAc2d.LastParameter());
|
|
||||||
if (Abs(p2d1.X() - Ufirst) <= Precision::Confusion() &&
|
|
||||||
Abs(p2d2.X() - Ulast) <= Precision::Confusion())
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
TopoDS_Vertex V1, V2;
|
TopoDS_Vertex V1, V2;
|
||||||
TopExp::Vertices(OldEdge, V1, V2);
|
TopExp::Vertices(OldEdge, V1, V2);
|
||||||
TopTools_ListOfShape LV1, LV2;
|
TopTools_ListOfShape LV1, LV2;
|
||||||
LV1.Append(Vf1);
|
LV1.Append(Vf1.Oriented(TopAbs_FORWARD));
|
||||||
LV2.Append(CurVertex);
|
LV2.Append(CurVertex.Oriented(TopAbs_FORWARD));
|
||||||
BRepTools_Substitution theSubstitutor;
|
BRepTools_Substitution theSubstitutor;
|
||||||
theSubstitutor.Substitute(V1, LV1);
|
theSubstitutor.Substitute(V1.Oriented(TopAbs_FORWARD), LV1);
|
||||||
if (!V1.IsSame(V2))
|
if (!V1.IsSame(V2))
|
||||||
theSubstitutor.Substitute(V2, LV2);
|
theSubstitutor.Substitute(V2.Oriented(TopAbs_FORWARD), LV2);
|
||||||
theSubstitutor.Substitute(OldEdge, NewEdges);
|
theSubstitutor.Substitute(OldEdge.Oriented(TopAbs_FORWARD), NewEdges);
|
||||||
theSubstitutor.Build(NewSphericalFace);
|
theSubstitutor.Build(NewSphericalFace);
|
||||||
if (theSubstitutor.IsCopied(NewSphericalFace))
|
if (theSubstitutor.IsCopied(NewSphericalFace))
|
||||||
{
|
{
|
||||||
|
28
tests/bugs/modalg_6/bug27134
Normal file
28
tests/bugs/modalg_6/bug27134
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC27134"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
######################################################
|
||||||
|
# Offset algorithm produces an invalid shape from a cone
|
||||||
|
######################################################
|
||||||
|
|
||||||
|
smallview
|
||||||
|
|
||||||
|
set expected_MaxTolerance 1.02470e-007
|
||||||
|
set tol_abs_MaxTolerance 1.e-08
|
||||||
|
set tol_rel_MaxTolerance 1.e-08
|
||||||
|
|
||||||
|
restore [locate_data_file bug27134_cone.brep] a
|
||||||
|
explode a f
|
||||||
|
donly a_1
|
||||||
|
offsetshape res a_1 10
|
||||||
|
fit
|
||||||
|
|
||||||
|
checknbshapes res -vertex 5 -edge 7 -wire 2 -face 2 -shell 1 -solid 0 -compsolid 0 -compound 0 -shape 17
|
||||||
|
|
||||||
|
checkshape res
|
||||||
|
|
||||||
|
regexp {Tolerance +MAX=([-0-9.+eE]+)} [tolerance res] full MaxTolerance
|
||||||
|
checkreal "MaxTolerance" ${MaxTolerance} ${expected_MaxTolerance} ${tol_abs_MaxTolerance} ${tol_rel_MaxTolerance}
|
||||||
|
|
||||||
|
checkview -screenshot -2d -path ${imagedir}/${test_image}.png
|
Loading…
x
Reference in New Issue
Block a user