0028677: Avoid change of wire orientation in BRepLib_MakeFace if the wire is open
authornbv <nbv@opencascade.com>
Mon, 24 Apr 2017 10:48:28 +0000 (13:48 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 5 May 2017 08:27:53 +0000 (11:27 +0300)
Method BRepLib_MakeFace::CheckInside() is not called for open wire. So, if the input wire is open its orientation is not changed in the result face.

16 files changed:
dox/dev_guides/upgrade/upgrade.md
src/BRepFill/BRepFill_OffsetWire.hxx
src/BRepLib/BRepLib_MakeFace.cxx
tests/bugs/modalg_5/bug25298_01
tests/bugs/modalg_5/bug25298_02
tests/bugs/modalg_5/bug25334_10
tests/bugs/modalg_5/bug25334_3
tests/bugs/modalg_5/bug25334_4
tests/bugs/modalg_5/bug25334_9
tests/bugs/modalg_6/bug26296_5
tests/bugs/modalg_6/bug26481
tests/bugs/modalg_6/bug6768
tests/offset/wire_unclosed_outside_0_005/B6
tests/offset/wire_unclosed_outside_0_025/B6
tests/offset/wire_unclosed_outside_0_075/A1
tests/offset/wire_unclosed_outside_0_075/B6

index cbe32b0..060f380 100644 (file)
@@ -1360,3 +1360,14 @@ if (anError != Storage_VSOk)
   // Error processing
 }
 ~~~~
+
+@subsection upgrade_720_Change_In_BRepLib_MakeFace_Algo Change in BRepLib_MakeFace algorithm
+
+  Previously, BRepLib_MakeFace algorithm changed orientation of the source wire in order to avoid creation of face as a hole (i.e. it is impossible to create single face as hole; hole can be created in context of another face only). New algorithm does not reverse the wire if it is open. Material of the face for open wire will be located on the left side from the source wire.
+
+@subsection upgrade_720_Change_In_BRepFill_OffsetWire Change in BRepFill_OffsetWire algorithm
+
+  Now, offset direction will always be to outer region in case of positive offset value and to inner region in case of negative offset value.
+  Inner/Outer region for open wire is defined by the following rule:
+    when we go along the wire (taking into account edges orientation) then outer region will be on the right side, inner region will be on the left side.
+  In case of closed wire, inner region will always be inside the wire (at that, edges orientation is not taken into account).
\ No newline at end of file
index 88542ce..f10987d 100644 (file)
@@ -44,9 +44,18 @@ class Bisector_Bisec;
 class BRepFill_TrimEdgeTool;
 
 
-//! Constructs a Offset Wire to a spine (wire or face)
-//! on the left of spine.
-//! The Wire or the Face must be planar.
+//! Constructs a Offset Wire to a spine (wire or face).
+//! Offset direction will be to outer region in case of
+//! positive offset value and to inner region in case of
+//! negative offset value.
+//! Inner/Outer region for open wire is defined by the
+//! following rule: when we go along the wire (taking into
+//! account of edges orientation) then outer region will be
+//! on the right side, inner region will be on the left side.
+//! In case of closed wire, inner region will always be
+//! inside the wire (at that, edges orientation is not taken
+//! into account).
+//! The Wire or the Face must be planar and oriented correctly.
 class BRepFill_OffsetWire 
 {
 public:
index 39663db..8046062 100644 (file)
@@ -270,7 +270,8 @@ BRepLib_MakeFace::BRepLib_MakeFace(const TopoDS_Wire& W,
   //
   BRepLib::SameParameter(myShape, tol, Standard_True);
   //
-  CheckInside();
+  if (BRep_Tool::IsClosed(W))
+    CheckInside();
 }
 
 
@@ -286,7 +287,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Pln& P,
   Handle(Geom_Plane) Pl = new Geom_Plane(P);
   Init(Pl, Standard_False, Precision::Confusion());
   Add(W);
-  if (Inside) CheckInside();
+  if (Inside && BRep_Tool::IsClosed(W)) CheckInside();
 }
 
 
@@ -302,7 +303,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cylinder& C,
   Handle(Geom_CylindricalSurface) GC = new Geom_CylindricalSurface(C);
   Init(GC, Standard_False, Precision::Confusion());
   Add(W);
-  if (Inside) CheckInside();
+  if (Inside && BRep_Tool::IsClosed(W)) CheckInside();
 }
 
 
@@ -318,7 +319,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Cone& C,
   Handle(Geom_ConicalSurface) GC = new Geom_ConicalSurface(C);
   Init(GC, Standard_False, Precision::Confusion());
   Add(W);
-  if (Inside) CheckInside();
+  if (Inside && BRep_Tool::IsClosed(W)) CheckInside();
 }
 
 
@@ -334,7 +335,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Sphere& S,
   Handle(Geom_SphericalSurface) GS = new Geom_SphericalSurface(S);
   Init(GS, Standard_False, Precision::Confusion());
   Add(W);
-  if (Inside) CheckInside();
+  if (Inside && BRep_Tool::IsClosed(W)) CheckInside();
 }
 
 
@@ -350,7 +351,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const gp_Torus& T,
   Handle(Geom_ToroidalSurface) GT = new Geom_ToroidalSurface(T);
   Init(GT, Standard_False, Precision::Confusion());
   Add(W);
-  if (Inside) CheckInside();
+  if (Inside && BRep_Tool::IsClosed(W)) CheckInside();
 }
 
 
@@ -365,7 +366,7 @@ BRepLib_MakeFace::BRepLib_MakeFace(const Handle(Geom_Surface)& S,
 {
   Init(S, Standard_False, Precision::Confusion());
   Add(W);
-  if (Inside) CheckInside();
+  if (Inside && BRep_Tool::IsClosed(W)) CheckInside();
 }
 
 
index 6ca8f28..ccb40b0 100755 (executable)
@@ -12,7 +12,7 @@ smallview
 display a
 fit
 
-if [catch { openoffset resoffset a 1 10 i } ] {
+if [catch { openoffset resoffset a 1 -10 i } ] {
   puts "Error : mkoffset is wrong"
 } else {
   renamevar resoffset_1 result
index ed3c90e..21e1d1e 100755 (executable)
@@ -12,7 +12,7 @@ smallview
 display a
 fit
 
-if [catch { openoffset resoffset a 1 -10 i } ] {
+if [catch { openoffset resoffset a 1 10 i } ] {
   puts "Error : mkoffset is wrong"
 } else {
   renamevar resoffset_1 result
index 4381638..671cf6a 100644 (file)
@@ -15,7 +15,7 @@ wire ww a_3 a_4
 
 donly ww
 
-openoffset res ww 1 -10
+openoffset res ww 1 10
 renamevar res_1 result
 
 fit
index b83950f..5291afb 100644 (file)
@@ -15,7 +15,7 @@ wire ww a_3
 
 donly ww
 
-openoffset res ww 1 10
+openoffset res ww 1 -10
 renamevar res_1 result
 
 fit
index d0bbf90..4e16e92 100644 (file)
@@ -15,7 +15,7 @@ wire ww a_3
 
 donly ww
 
-openoffset res ww 1 -10
+openoffset res ww 1 10
 renamevar res_1 result
 
 fit
index 66cb996..c301fc6 100644 (file)
@@ -15,7 +15,7 @@ wire ww a_3 a_4
 
 donly ww
 
-openoffset res ww 1 10
+openoffset res ww 1 -10
 renamevar res_1 result
 
 fit
index e089e75..d9189e1 100755 (executable)
@@ -12,7 +12,7 @@ smallview
 display a
 fit
 
-if [catch { openoffset resoffset a 1 6. i } ] {
+if [catch { openoffset resoffset a 1 -6. i } ] {
   puts "Error : openoffset is wrong"
 } else {
   renamevar resoffset_1 result
index 2269cf8..f69939f 100644 (file)
@@ -10,7 +10,7 @@ smallview
 
 restore [locate_data_file bug26296_linesarc.brep] a
 fit
-openoffset r a 4 10.
+openoffset r a 4 -10.
 fit
 
 checkview -screenshot -2d -path ${imagedir}/${test_image}.png
index 381d16f..75d7712 100644 (file)
@@ -11,7 +11,7 @@ explode co
 foreach s {co_1 co_2 co_3 co_4} {
 
 puts "\n*** make offset of wire r$s\n"
-mkoffset r${s} ${s} 1 1
+mkoffset r${s} ${s} 1 -1
 
 regexp {nb alone Vertices : ([-0-9.+eE]+)} [checksection r${s}_1] full nbv
 
index 0011e4e..3ebf614 100644 (file)
@@ -1,7 +1,8 @@
 restore [locate_data_file offset_wire_058.brep] s
 
+set off_param -$off_param
+
 set length 3316.27
 set nbsh_v 62
 set nbsh_e 62
-set nbsh_w 1
-
+set nbsh_w 1
\ No newline at end of file
index ecbabe5..25bb0c2 100644 (file)
@@ -1,5 +1,7 @@
 restore [locate_data_file offset_wire_058.brep] s
 
+set off_param -$off_param
+
 set length 2582.56
 set nbsh_v 47
 set nbsh_e 47
index 0c6f6ff..ba1098e 100644 (file)
@@ -5,6 +5,9 @@ puts "TODO OCC24156 MacOS: Error : The length of result shape is"
 puts "TODO OCC24156 MacOS: Error : The resulting shape is WRONG"
 
 restore [locate_data_file offset_wire_001.brep] s
+
+set off_param -$off_param
+
 set length 11.6898
 set nbsh_v 23
 set nbsh_e 23
index 1736ba2..f03ff59 100644 (file)
@@ -1,5 +1,7 @@
 restore [locate_data_file offset_wire_058.brep] s
 
+set off_param -$off_param
+
 set length 3127.75
 set nbsh_v 39
 set nbsh_e 39