]> OCCT Git - occt-copy.git/commitdiff
Support of implementation of the algorithm for replacing faces in shape with new...
authorjgv <jgv@opencascade.com>
Mon, 14 Aug 2017 11:48:07 +0000 (14:48 +0300)
committermsv <msv@opencascade.com>
Fri, 9 Feb 2018 13:05:37 +0000 (16:05 +0300)
- Add the flag UseInfini in the method BRepOffset_Tool::EnLargeFace, defining whether it is needed to use infinite enlarge of a face or not.

- Add the method TopExp::MapShapesAndUniqueAncestors().

- Increase the value of extension in EnlargeGeometry to provide proper intersection of adjacent faces.

src/BRepOffset/BRepOffset_Tool.cxx
src/BRepOffset/BRepOffset_Tool.hxx
src/TopExp/TopExp.cxx
src/TopExp/TopExp.hxx

index 89d56769327f52c09e9ff5dbba0d7900f1e5e18b..f93dc6ff93ebb8032825cb80ec942d4a48100bfe 100644 (file)
@@ -2834,7 +2834,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
                                        const Standard_Boolean GlobalEnlargeVfirst,
                                        const Standard_Boolean GlobalEnlargeVlast)
 {
-  const Standard_Real coeff = 4.;
+  const Standard_Real coeff = 1.;
   const Standard_Real TolApex = 1.e-5;
 
   Standard_Boolean SurfaceChange = Standard_False;
@@ -2882,7 +2882,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
        {
          viso = S->VIso( vf1 );
          GeomAdaptor_Curve gac( viso );
-         du = GCPnts_AbscissaPoint::Length( gac ) / coeff;
+         du = GCPnts_AbscissaPoint::Length( gac ) * coeff;
          uiso1 = S->UIso( uf1 );
          uiso2 = S->UIso( uf2 );
          if (BRepOffset_Tool::Gabarit( uiso1 ) <= TolApex)
@@ -2903,7 +2903,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
        {
          uiso = S->UIso( uf1 );
          GeomAdaptor_Curve gac( uiso );
-         dv = GCPnts_AbscissaPoint::Length( gac ) / coeff;
+         dv = GCPnts_AbscissaPoint::Length( gac ) * coeff;
          viso1 = S->VIso( vf1 );
          viso2 = S->VIso( vf2 );
          if (BRepOffset_Tool::Gabarit( viso1 ) <= TolApex)
@@ -2958,7 +2958,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
        {
          viso = S->VIso( v1 );
          gac.Load( viso );
-         du = GCPnts_AbscissaPoint::Length( gac ) / coeff;
+         du = GCPnts_AbscissaPoint::Length( gac ) * coeff;
          uiso1 = S->UIso( u1 );
          uiso2 = S->UIso( u2 );
          if (BRepOffset_Tool::Gabarit( uiso1 ) <= TolApex)
@@ -2970,7 +2970,7 @@ static Standard_Boolean EnlargeGeometry(Handle(Geom_Surface)& S,
        {
          uiso = S->UIso( u1 );
          gac.Load( uiso );
-         dv = GCPnts_AbscissaPoint::Length( gac ) / coeff;
+         dv = GCPnts_AbscissaPoint::Length( gac ) * coeff;
          viso1 = S->VIso( v1 );
          viso2 = S->VIso( v2 );
          if (BRepOffset_Tool::Gabarit( viso1 ) <= TolApex)
@@ -3217,7 +3217,8 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
  const Standard_Boolean   UpdatePCurve,
  const Standard_Boolean   enlargeU,
  const Standard_Boolean   enlargeVfirst,
- const Standard_Boolean   enlargeVlast)
+ const Standard_Boolean   enlargeVlast,
+ const Standard_Boolean   UseInfini)
 {
   //---------------------------
   // extension de la geometrie.
@@ -3249,8 +3250,20 @@ Standard_Boolean BRepOffset_Tool::EnLargeFace
   }
 
   S->Bounds            (US1,US2,VS1,VS2);
-  UU1 = VV1 = - infini;
-  UU2 = VV2 =   infini;
+  if (UseInfini)
+  {
+    UU1 = VV1 = - infini;
+    UU2 = VV2 =   infini;
+  }
+  else
+  {
+    Standard_Real FaceDU = UF2 - UF1;
+    Standard_Real FaceDV = VF2 - VF1;
+    UU1 = UF1 - FaceDU;
+    UU2 = UF2 + FaceDU;
+    VV1 = VF1 - FaceDV;
+    VV2 = VF2 + FaceDV;
+  }
   
   if (CanExtentSurface) {
     SurfaceChange = EnlargeGeometry( S, UU1, UU2, VV1, VV2, isVV1degen, isVV2degen, UF1, UF2, VF1, VF2,
index c4d9e3f681e6e81f6e93dbb277ab7ebdda0e4d1f..1a4808d7dbe6d063230b340ae16fe916c986d055 100644 (file)
@@ -104,8 +104,15 @@ public:
   //! if <UpdatePCurve>  is  TRUE, update the  pcurves of the
   //! edges of <F> on   the new surface.if the surface has  been changed,
   //! Returns  True if The Surface of  <NF> has changed.
-  Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F, TopoDS_Face& NF, const Standard_Boolean ChangeGeom, const Standard_Boolean UpDatePCurve = Standard_False, const Standard_Boolean enlargeU = Standard_True, const Standard_Boolean enlargeVfirst = Standard_True, const Standard_Boolean enlargeVlast = Standard_True);
-  
+  Standard_EXPORT static Standard_Boolean EnLargeFace (const TopoDS_Face& F,
+                                                       TopoDS_Face& NF,
+                                                       const Standard_Boolean ChangeGeom,
+                                                       const Standard_Boolean UpDatePCurve = Standard_False,
+                                                       const Standard_Boolean enlargeU = Standard_True,
+                                                       const Standard_Boolean enlargeVfirst = Standard_True,
+                                                       const Standard_Boolean enlargeVlast = Standard_True,
+                                                       const Standard_Boolean UseInfini = Standard_True);
+
   Standard_EXPORT static void ExtentFace (const TopoDS_Face& F, TopTools_DataMapOfShapeShape& ConstShapes, TopTools_DataMapOfShapeShape& ToBuild, const TopAbs_State Side, const Standard_Real TolConf, TopoDS_Face& NF);
   
   //! Via the wire explorer store in <NOnV1> for
index ff63bbe973965cc24989ef86cd642fe008eeca47..b011b50c7c112d4084058f04124e392138ad9a59 100644 (file)
@@ -99,7 +99,55 @@ void  TopExp::MapShapesAndAncestors
   }
 }
 
+//=======================================================================
+//function : MapShapesAndUniqueAncestors
+//purpose  : 
+//=======================================================================
 
+void  TopExp::MapShapesAndUniqueAncestors
+  (const TopoDS_Shape& S, 
+   const TopAbs_ShapeEnum TS, 
+   const TopAbs_ShapeEnum TA, 
+   TopTools_IndexedDataMapOfShapeListOfShape& M,
+   const Standard_Boolean useOrientation)
+{
+  TopTools_ListOfShape empty;
+  
+  // visit ancestors
+  TopExp_Explorer exa(S,TA);
+  while (exa.More())
+  {
+    // visit shapes
+    const TopoDS_Shape& anc = exa.Current();
+    TopExp_Explorer exs(anc,TS);
+    while (exs.More())
+    {
+      Standard_Integer index = M.FindIndex(exs.Current());
+      if (index == 0)
+        index = M.Add(exs.Current(),empty);
+      TopTools_ListOfShape& aList = M(index);
+      // check if anc already exists in a list
+      TopTools_ListIteratorOfListOfShape it(aList);
+      for (; it.More(); it.Next())
+        if (useOrientation? anc.IsEqual(it.Value()) : anc.IsSame(it.Value()))
+          break;
+      if (!it.More())
+        aList.Append(anc);
+      exs.Next();
+    }
+    exa.Next();
+  }
+
+  // visit shapes not under ancestors
+  TopExp_Explorer ex(S,TS,TA);
+  while (ex.More())
+  {
+    Standard_Integer index = M.FindIndex(ex.Current());
+    if (index == 0) 
+      M.Add(ex.Current(),empty);
+    ex.Next();
+  }
+}
 
 //=======================================================================
 //function : FirstVertex
index 25ccde43b8a790e671185aaadc880610bb8cdab4..34e45eee4abae6857ef5e3b186c70f65c386c73a 100644 (file)
@@ -66,6 +66,18 @@ public:
   //! Warning: The map is not cleared at first.
   Standard_EXPORT static void MapShapesAndAncestors (const TopoDS_Shape& S, const TopAbs_ShapeEnum TS, const TopAbs_ShapeEnum TA, TopTools_IndexedDataMapOfShapeListOfShape& M);
   
+  //! Stores in the map <M> all the subshape of <S> of
+  //! type <TS> for each one append to the list all
+  //! unique ancestors of type <TA>.  For example map all
+  //! the edges and bind the list of faces.
+  //! useOrientation = True : taking account the ancestor orientation
+  //! Warning: The map is not cleared at first.
+  Standard_EXPORT static void MapShapesAndUniqueAncestors (const TopoDS_Shape& S,
+                                                           const TopAbs_ShapeEnum TS,
+                                                           const TopAbs_ShapeEnum TA,
+                                                           TopTools_IndexedDataMapOfShapeListOfShape& M,
+                                                           const Standard_Boolean useOrientation = Standard_False);
+
   //! Returns the Vertex of orientation FORWARD in E. If
   //! there is none returns a Null Shape.
   //! CumOri = True : taking account the edge orientation