mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0025704: BRepOffsetAPI_MakeOffset: some customer's cases are processed incorrect
Added test cases bugs/modalg_5/bug25704_1 - bug25704_6
This commit is contained in:
@@ -215,6 +215,7 @@ static void MakeOffset
|
|||||||
BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
|
BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
|
||||||
const Handle(Geom_Plane)& RefPlane,
|
const Handle(Geom_Plane)& RefPlane,
|
||||||
const Standard_Boolean IsOpenResult,
|
const Standard_Boolean IsOpenResult,
|
||||||
|
const GeomAbs_JoinType theJoinType,
|
||||||
const TopoDS_Vertex * Ends);
|
const TopoDS_Vertex * Ends);
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@@ -255,24 +256,31 @@ static Standard_Boolean KPartCircle
|
|||||||
IsOpenResult)
|
IsOpenResult)
|
||||||
{
|
{
|
||||||
Standard_Real anOffset = myOffset;
|
Standard_Real anOffset = myOffset;
|
||||||
if (E.Orientation() == TopAbs_REVERSED) anOffset *= -1;
|
|
||||||
|
|
||||||
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(E, mySpine, f, l);
|
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(E, mySpine, f, l);
|
||||||
Handle(Geom2dAdaptor_HCurve) AHC = new Geom2dAdaptor_HCurve(aPCurve, f, l);
|
Handle(Geom2dAdaptor_HCurve) AHC = new Geom2dAdaptor_HCurve(aPCurve, f, l);
|
||||||
Handle(Geom2d_Curve) OC;
|
Handle(Geom2d_Curve) OC;
|
||||||
if (AHC->GetType() == GeomAbs_Line)
|
if (AHC->GetType() == GeomAbs_Line)
|
||||||
{
|
{
|
||||||
|
if (E.Orientation() == TopAbs_REVERSED) anOffset *= -1;
|
||||||
Adaptor3d_OffsetCurve Off(AHC,anOffset);
|
Adaptor3d_OffsetCurve Off(AHC,anOffset);
|
||||||
OC = new Geom2d_Line(Off.Line());
|
OC = new Geom2d_Line(Off.Line());
|
||||||
}
|
}
|
||||||
else if (AHC->GetType() == GeomAbs_Circle)
|
else if (AHC->GetType() == GeomAbs_Circle)
|
||||||
{
|
{
|
||||||
|
if (E.Orientation() == TopAbs_FORWARD) anOffset *= -1;
|
||||||
gp_Circ2d theCirc = AHC->Circle();
|
gp_Circ2d theCirc = AHC->Circle();
|
||||||
if (anOffset < 0. || Abs(anOffset) < theCirc.Radius())
|
if (anOffset > 0. || Abs(anOffset) < theCirc.Radius())
|
||||||
OC = new Geom2d_Circle (theCirc.Position(), theCirc.Radius() - anOffset);
|
OC = new Geom2d_Circle (theCirc.Position(), theCirc.Radius() + anOffset);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myIsDone = Standard_False;
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (E.Orientation() == TopAbs_REVERSED) anOffset *= -1;
|
||||||
Handle(Geom2d_TrimmedCurve) G2dT = new Geom2d_TrimmedCurve(aPCurve, f, l);
|
Handle(Geom2d_TrimmedCurve) G2dT = new Geom2d_TrimmedCurve(aPCurve, f, l);
|
||||||
OC = new Geom2d_OffsetCurve( G2dT, anOffset);
|
OC = new Geom2d_OffsetCurve( G2dT, anOffset);
|
||||||
}
|
}
|
||||||
@@ -790,7 +798,7 @@ void BRepFill_OffsetWire::PerformWithBiLo
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MakeOffset (TopoDS::Edge(SE),myWorkSpine,myOffset,myMap,RefPlane,
|
MakeOffset (TopoDS::Edge(SE),myWorkSpine,myOffset,myMap,RefPlane,
|
||||||
myIsOpenResult, Ends);
|
myIsOpenResult, myJoinType, Ends);
|
||||||
PE = SE;
|
PE = SE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1941,6 +1949,7 @@ void MakeOffset (const TopoDS_Edge& E,
|
|||||||
BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
|
BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
|
||||||
const Handle(Geom_Plane)& RefPlane,
|
const Handle(Geom_Plane)& RefPlane,
|
||||||
const Standard_Boolean IsOpenResult,
|
const Standard_Boolean IsOpenResult,
|
||||||
|
const GeomAbs_JoinType theJoinType,
|
||||||
const TopoDS_Vertex * Ends)
|
const TopoDS_Vertex * Ends)
|
||||||
{
|
{
|
||||||
Standard_Real f,l;
|
Standard_Real f,l;
|
||||||
@@ -1984,11 +1993,31 @@ void MakeOffset (const TopoDS_Edge& E,
|
|||||||
Handle(Geom2d_Circle) CC = new Geom2d_Circle(Off.Circle());
|
Handle(Geom2d_Circle) CC = new Geom2d_Circle(Off.Circle());
|
||||||
|
|
||||||
Standard_Real Delta = 2*M_PI - l + f;
|
Standard_Real Delta = 2*M_PI - l + f;
|
||||||
|
if (theJoinType == GeomAbs_Arc)
|
||||||
|
{
|
||||||
if (ToExtendFirstPar)
|
if (ToExtendFirstPar)
|
||||||
f -= 0.2*Delta;
|
f -= 0.2*Delta;
|
||||||
if (ToExtendLastPar)
|
if (ToExtendLastPar)
|
||||||
l += 0.2*Delta;
|
l += 0.2*Delta;
|
||||||
|
}
|
||||||
|
else //GeomAbs_Intersection
|
||||||
|
{
|
||||||
|
if (ToExtendFirstPar && ToExtendLastPar)
|
||||||
|
{
|
||||||
|
Standard_Real old_l = l;
|
||||||
|
f = old_l + Delta/2.;
|
||||||
|
l = f + 2*M_PI;
|
||||||
|
}
|
||||||
|
else if (ToExtendFirstPar)
|
||||||
|
{
|
||||||
|
f = l;
|
||||||
|
l = f + 2*M_PI;
|
||||||
|
}
|
||||||
|
else if (ToExtendLastPar)
|
||||||
|
{
|
||||||
|
l = f + 2*M_PI;
|
||||||
|
}
|
||||||
|
}
|
||||||
G2dOC = new Geom2d_TrimmedCurve(CC,f,l);
|
G2dOC = new Geom2d_TrimmedCurve(CC,f,l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1999,9 +2028,19 @@ void MakeOffset (const TopoDS_Edge& E,
|
|||||||
Handle(Geom2d_Line) CC = new Geom2d_Line(Off.Line());
|
Handle(Geom2d_Line) CC = new Geom2d_Line(Off.Line());
|
||||||
Standard_Real Delta = (l - f);
|
Standard_Real Delta = (l - f);
|
||||||
if (ToExtendFirstPar)
|
if (ToExtendFirstPar)
|
||||||
|
{
|
||||||
|
if (theJoinType == GeomAbs_Arc)
|
||||||
f -= Delta;
|
f -= Delta;
|
||||||
|
else //GeomAbs_Intersection
|
||||||
|
f = -Precision::Infinite();
|
||||||
|
}
|
||||||
if (ToExtendLastPar)
|
if (ToExtendLastPar)
|
||||||
|
{
|
||||||
|
if (theJoinType == GeomAbs_Arc)
|
||||||
l += Delta;
|
l += Delta;
|
||||||
|
else //GeomAbs_Intersection
|
||||||
|
l = Precision::Infinite();
|
||||||
|
}
|
||||||
G2dOC = new Geom2d_TrimmedCurve(CC,f,l);
|
G2dOC = new Geom2d_TrimmedCurve(CC,f,l);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
34
tests/bugs/modalg_5/bug25704_1
Normal file
34
tests/bugs/modalg_5/bug25704_1
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25704"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# BRepOffsetAPI_MakeOffset: some customer's cases are processed incorrect
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
circle a 0 0 0 10
|
||||||
|
mkedge a a
|
||||||
|
wire a a
|
||||||
|
|
||||||
|
if [catch { mkoffset resoffset a 1 2. } ] {
|
||||||
|
puts "Error : mkoffset is wrong"
|
||||||
|
} else {
|
||||||
|
renamevar resoffset_1 result
|
||||||
|
|
||||||
|
set length 50.2655
|
||||||
|
|
||||||
|
set nb_v_good 1
|
||||||
|
set nb_e_good 1
|
||||||
|
set nb_w_good 1
|
||||||
|
set nb_f_good 0
|
||||||
|
set nb_sh_good 0
|
||||||
|
set nb_sol_good 0
|
||||||
|
set nb_compsol_good 0
|
||||||
|
set nb_compound_good 0
|
||||||
|
set nb_shape_good 3
|
||||||
|
}
|
||||||
|
|
||||||
|
smallview
|
||||||
|
display a
|
||||||
|
fit
|
||||||
|
set only_screen_axo 1
|
34
tests/bugs/modalg_5/bug25704_2
Normal file
34
tests/bugs/modalg_5/bug25704_2
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25704"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# BRepOffsetAPI_MakeOffset: some customer's cases are processed incorrect
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
circle a 0 0 0 10
|
||||||
|
mkedge a a
|
||||||
|
wire a a
|
||||||
|
|
||||||
|
if [catch { mkoffset resoffset a 1 -3. } ] {
|
||||||
|
puts "Error : mkoffset is wrong"
|
||||||
|
} else {
|
||||||
|
renamevar resoffset_1 result
|
||||||
|
|
||||||
|
set length 81.6814
|
||||||
|
|
||||||
|
set nb_v_good 1
|
||||||
|
set nb_e_good 1
|
||||||
|
set nb_w_good 1
|
||||||
|
set nb_f_good 0
|
||||||
|
set nb_sh_good 0
|
||||||
|
set nb_sol_good 0
|
||||||
|
set nb_compsol_good 0
|
||||||
|
set nb_compound_good 0
|
||||||
|
set nb_shape_good 3
|
||||||
|
}
|
||||||
|
|
||||||
|
smallview
|
||||||
|
display a
|
||||||
|
fit
|
||||||
|
set only_screen_axo 1
|
32
tests/bugs/modalg_5/bug25704_3
Normal file
32
tests/bugs/modalg_5/bug25704_3
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25704"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# BRepOffsetAPI_MakeOffset: some customer's cases are processed incorrect
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug25491_offset_lines_2.brep] a
|
||||||
|
|
||||||
|
if [catch { mkoffset resoffset a 1 35. i } ] {
|
||||||
|
puts "Error : mkoffset is wrong"
|
||||||
|
} else {
|
||||||
|
renamevar resoffset_1 result
|
||||||
|
|
||||||
|
set length 730
|
||||||
|
|
||||||
|
set nb_v_good 8
|
||||||
|
set nb_e_good 8
|
||||||
|
set nb_w_good 1
|
||||||
|
set nb_f_good 0
|
||||||
|
set nb_sh_good 0
|
||||||
|
set nb_sol_good 0
|
||||||
|
set nb_compsol_good 0
|
||||||
|
set nb_compound_good 0
|
||||||
|
set nb_shape_good 17
|
||||||
|
}
|
||||||
|
|
||||||
|
smallview
|
||||||
|
display a
|
||||||
|
fit
|
||||||
|
set only_screen_axo 1
|
32
tests/bugs/modalg_5/bug25704_4
Normal file
32
tests/bugs/modalg_5/bug25704_4
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25704"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# BRepOffsetAPI_MakeOffset: some customer's cases are processed incorrect
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug25491_offset_lines_2.brep] a
|
||||||
|
|
||||||
|
if [catch { mkoffset resoffset a 1 40. i } ] {
|
||||||
|
puts "Error : mkoffset is wrong"
|
||||||
|
} else {
|
||||||
|
renamevar resoffset_1 result
|
||||||
|
|
||||||
|
set length 770
|
||||||
|
|
||||||
|
set nb_v_good 8
|
||||||
|
set nb_e_good 8
|
||||||
|
set nb_w_good 1
|
||||||
|
set nb_f_good 0
|
||||||
|
set nb_sh_good 0
|
||||||
|
set nb_sol_good 0
|
||||||
|
set nb_compsol_good 0
|
||||||
|
set nb_compound_good 0
|
||||||
|
set nb_shape_good 17
|
||||||
|
}
|
||||||
|
|
||||||
|
smallview
|
||||||
|
display a
|
||||||
|
fit
|
||||||
|
set only_screen_axo 1
|
32
tests/bugs/modalg_5/bug25704_5
Normal file
32
tests/bugs/modalg_5/bug25704_5
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25704"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# BRepOffsetAPI_MakeOffset: some customer's cases are processed incorrect
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug25704_offset_lines_case3.brep] a
|
||||||
|
|
||||||
|
if [catch { mkoffset resoffset a 1 1. i } ] {
|
||||||
|
puts "Error : mkoffset is wrong"
|
||||||
|
} else {
|
||||||
|
renamevar resoffset_1 result
|
||||||
|
|
||||||
|
set length 38.9737
|
||||||
|
|
||||||
|
set nb_v_good 5
|
||||||
|
set nb_e_good 5
|
||||||
|
set nb_w_good 1
|
||||||
|
set nb_f_good 0
|
||||||
|
set nb_sh_good 0
|
||||||
|
set nb_sol_good 0
|
||||||
|
set nb_compsol_good 0
|
||||||
|
set nb_compound_good 0
|
||||||
|
set nb_shape_good 11
|
||||||
|
}
|
||||||
|
|
||||||
|
smallview
|
||||||
|
display a
|
||||||
|
fit
|
||||||
|
set only_screen_axo 1
|
32
tests/bugs/modalg_5/bug25704_6
Normal file
32
tests/bugs/modalg_5/bug25704_6
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25704"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# BRepOffsetAPI_MakeOffset: some customer's cases are processed incorrect
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug25704_twolines.brep] a
|
||||||
|
|
||||||
|
if [catch { openoffset resoffset a 5 5 i } ] {
|
||||||
|
puts "Error : mkoffset is wrong"
|
||||||
|
} else {
|
||||||
|
renamevar resoffset_1 result
|
||||||
|
|
||||||
|
set length 169.12
|
||||||
|
|
||||||
|
set nb_v_good 4
|
||||||
|
set nb_e_good 3
|
||||||
|
set nb_w_good 1
|
||||||
|
set nb_f_good 0
|
||||||
|
set nb_sh_good 0
|
||||||
|
set nb_sol_good 0
|
||||||
|
set nb_compsol_good 0
|
||||||
|
set nb_compound_good 0
|
||||||
|
set nb_shape_good 8
|
||||||
|
}
|
||||||
|
|
||||||
|
smallview
|
||||||
|
display a
|
||||||
|
fit
|
||||||
|
set only_screen_axo 1
|
Reference in New Issue
Block a user