]> OCCT Git - occt-copy.git/commitdiff
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 cbe32b0cc090b6f62a9de5082f53ca22d0f73e96..060f3801d3b1b28efe823f5a50391dda900828a5 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 88542ce2ceb8b81623b5e0fa88f0f91ac2e41bce..f10987dafafd823c0eb616ecc8790ac82f27c574 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 39663dbaf039c86c7c22c77dc81a3415816c53f7..8046062ce58455a0fbd3887a7769a03bbc96ed03 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 6ca8f28154761abce6b650b31e28ba862363044d..ccb40b06cc82c7c6b0d07aa762f73dca9eabd745 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 ed3c90e9d6a211717dbbc3af9f92bf81e8717143..21e1d1ea3c0036fe558125d97546d3da622c843f 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 4381638f0029c6f5001c2b3b3d9338edfaebfdc4..671cf6aa075a51c5fb1ad04d5b4d4246f3afcb82 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 b83950fa44276a650e5f30d63ff5075ad7f0ea4c..5291afb78afea62fc572fa757baea8a3db4fdf91 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 d0bbf9011e3bcd93c69a8b62d52847dacd892d57..4e16e92a056eb62b5bbfb3483aa9724ca66e0011 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 66cb9962d0f66e98031d9e3ef4f5ff52f708863e..c301fc61e65bfbea65833e8d7227f6276a35644f 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 e089e75244a958636d640309d20d08a0293f02ff..d9189e1c7972be1b8f7e30687801d2e1ea789630 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 2269cf8150b9ff7c5d5c639f4f9f675a97007b73..f69939fb6d1d35df65f98d5b4557ece9faae1aea 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 381d16f948631065f06c24b84d6d6082076f028e..75d77126696f1d9ae9809f9bfe7967649406fdf5 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 0011e4ea6957a511ff43ff8ab32bda7e63bf1b0a..3ebf6145cfdefd31024ace5a1aaa0fa8f649899a 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 ecbabe56cad883133688c12f7afe222612ae2f23..25bb0c2f386f2a89c75d2a1e96cfbb9ad56d9af3 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 0c6f6ffc62e687f89ec68628ab08feb4cc623219..ba1098ee70feecde4cf92625cc3412dadac1b65c 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 1736ba2df91d58b324eb9e6c2664881b9c224e13..f03ff598dc7d12235f3f39da9ec43620d45470cc 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