1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0028684: BRepOffsetAPI_MakeOffset produces wire with another orientation in compare with source wire

Added flag to reverse resulting shape, if it was reverse in BuildDomains() to bringing to the same direction as the original shape
This commit is contained in:
akaftasev 2021-08-24 22:47:18 +03:00 committed by smoskvin
parent 8f70959571
commit 55b5d19bd8
24 changed files with 136 additions and 8 deletions

View File

@ -138,7 +138,8 @@ static void BuildDomains(TopoDS_Face& myFace,
BRepFill_ListOfOffsetWire& myAlgos,
GeomAbs_JoinType myJoin,
Standard_Boolean myIsOpenResult,
Standard_Boolean isPositive)
Standard_Boolean isPositive,
Standard_Boolean& isWasReversed)
{
BRepAlgo_FaceRestrictor FR;
TopoDS_Vertex VF,VL;
@ -164,6 +165,7 @@ static void BuildDomains(TopoDS_Face& myFace,
const TopoDS_Shape& W = itl.Value();
LWires.Append(W.Reversed());
}
isWasReversed = Standard_True;
WorkWires = LWires;
}
}
@ -296,13 +298,13 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset,
BRep_Builder B;
B.MakeCompound (Res);
myLastIsLeft = (Offset <= 0);
Standard_Boolean isWasReversed = Standard_False;
if( Offset <= 0. )
{
if( myLeft.IsEmpty() )
{
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 Begin
BuildDomains(myFace,myWires,myLeft,myJoin,myIsOpenResult, Standard_False);
BuildDomains(myFace,myWires,myLeft,myJoin,myIsOpenResult, Standard_False, isWasReversed);
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:26 2001 End
}
@ -312,9 +314,9 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset,
Algo.Perform(Abs(Offset),Alt);
if (Algo.IsDone() && !Algo.Shape().IsNull())
{
B.Add(Res,Algo.Shape());
B.Add(Res,isWasReversed ? Algo.Shape().Reversed() : Algo.Shape());
if (i == 1)
myShape = Algo.Shape();
myShape = isWasReversed ? Algo.Shape().Reversed() : Algo.Shape();
i++;
}
@ -325,7 +327,7 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset,
if (myRight.IsEmpty())
{
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:28 2001 Begin
BuildDomains(myFace,myWires,myRight,myJoin,myIsOpenResult, Standard_True);
BuildDomains(myFace,myWires,myRight,myJoin,myIsOpenResult, Standard_True, isWasReversed);
// Modified by Sergey KHROMOV - Fri Apr 27 14:35:35 2001 End
}
@ -336,10 +338,10 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset,
if (Algo.IsDone() && !Algo.Shape().IsNull())
{
B.Add(Res,Algo.Shape());
B.Add(Res, isWasReversed ? Algo.Shape().Reversed() : Algo.Shape());
if (i == 1)
myShape = Algo.Shape();
myShape = isWasReversed ? Algo.Shape().Reversed() : Algo.Shape();
i++;
}

View File

@ -12,11 +12,15 @@ smallview
display a
fit
vori a
if [catch { openoffset resoffset a 1 10 i } ] {
puts "Error : mkoffset is wrong"
} else {
renamevar resoffset_1 result
vori result
checkprops result -l 159.96
checkshape result
checksection result

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 613.39

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 548.106

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 846.702

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 -10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 768.339

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 1216.59

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 -10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 1132.6

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 1042.35

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 -10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 937.174

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 1211.6

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 -10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 1143.61

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 752.799

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 -10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 644.509

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 -10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 705.994

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 -10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 354.958

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 386.077

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 840.157

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 -10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 782.224

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 559.65

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 -10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 533.593

View File

@ -18,6 +18,9 @@ donly ww
openoffset res ww 1 -10
renamevar res_1 result
vori ww
vori result
fit
checkprops result -l 558.479

View File

@ -0,0 +1,31 @@
puts "============"
puts "OCC25298: Modeling Algorithms - BRepOffsetAPI_MakeOffset produces wire with another orientation in compare with source wire"
puts "============"
puts ""
circle c 0 0 0 100
mkedge e c
wire a e
smallview
display a
fit
vori a
if [catch { mkoffset resoffset a 1 10 } ] {
puts "Error : mkoffset is wrong"
} else {
renamevar resoffset_1 result
vori result
checkprops result -l 691.15
checkshape result
checksection result
display result
fit
}
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@ -0,0 +1,31 @@
puts "============"
puts "OCC25298: Modeling Algorithms - BRepOffsetAPI_MakeOffset produces wire with another orientation in compare with source wire"
puts "============"
puts ""
circle c 0 0 0 100
mkedge e c
wire a e
smallview
display a
fit
vori a
if [catch { mkoffset resoffset a 1 -10 } ] {
puts "Error : mkoffset is wrong"
} else {
renamevar resoffset_1 result
vori result
checkprops result -l 565.487
checkshape result
checksection result
display result
fit
}
checkview -screenshot -2d -path ${imagedir}/${test_image}.png