From: jgv Date: Mon, 14 Aug 2017 11:48:07 +0000 (+0300) Subject: Support of implementation of the algorithm for replacing faces in shape with new... X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=2031d84f45867b757f6cde46419a359b45ceddd2;p=occt-copy.git Support of implementation of the algorithm for replacing faces in shape with new faces based on other surfaces - PatchFaces. For that: - 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. --- diff --git a/src/BRepOffset/BRepOffset_Tool.cxx b/src/BRepOffset/BRepOffset_Tool.cxx index 89d5676932..f93dc6ff93 100644 --- a/src/BRepOffset/BRepOffset_Tool.cxx +++ b/src/BRepOffset/BRepOffset_Tool.cxx @@ -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, diff --git a/src/BRepOffset/BRepOffset_Tool.hxx b/src/BRepOffset/BRepOffset_Tool.hxx index c4d9e3f681..1a4808d7db 100644 --- a/src/BRepOffset/BRepOffset_Tool.hxx +++ b/src/BRepOffset/BRepOffset_Tool.hxx @@ -104,8 +104,15 @@ public: //! if is TRUE, update the pcurves of the //! edges of on the new surface.if the surface has been changed, //! Returns True if The Surface of 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 for diff --git a/src/TopExp/TopExp.cxx b/src/TopExp/TopExp.cxx index ff63bbe973..b011b50c7c 100644 --- a/src/TopExp/TopExp.cxx +++ b/src/TopExp/TopExp.cxx @@ -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 diff --git a/src/TopExp/TopExp.hxx b/src/TopExp/TopExp.hxx index 25ccde43b8..34e45eee4a 100644 --- a/src/TopExp/TopExp.hxx +++ b/src/TopExp/TopExp.hxx @@ -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 all the subshape of of + //! type for each one append to the list all + //! unique ancestors of type . 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