Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 09:16:42

0001 // Created on: 1995-04-19
0002 // Created by: Yves FRICAUD
0003 // Copyright (c) 1995-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRepFill_OffsetWire_HeaderFile
0018 #define _BRepFill_OffsetWire_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopoDS_Face.hxx>
0024 #include <TopoDS_Shape.hxx>
0025 #include <NCollection_List.hxx>
0026 #include <NCollection_IndexedDataMap.hxx>
0027 #include <BRepMAT2d_BisectingLocus.hxx>
0028 #include <BRepMAT2d_LinkTopoBilo.hxx>
0029 #include <TopTools_ShapeMapHasher.hxx>
0030 #include <NCollection_DataMap.hxx>
0031 #include <NCollection_Sequence.hxx>
0032 #include <gp_Pnt.hxx>
0033 class Bisector_Bisec;
0034 class BRepFill_TrimEdgeTool;
0035 
0036 //! Constructs a Offset Wire to a spine (wire or face).
0037 //! Offset direction will be to outer region in case of
0038 //! positive offset value and to inner region in case of
0039 //! negative offset value.
0040 //! Inner/Outer region for open wire is defined by the
0041 //! following rule: when we go along the wire (taking into
0042 //! account of edges orientation) then outer region will be
0043 //! on the right side, inner region will be on the left side.
0044 //! In case of closed wire, inner region will always be
0045 //! inside the wire (at that, edges orientation is not taken
0046 //! into account).
0047 //! The Wire or the Face must be planar and oriented correctly.
0048 class BRepFill_OffsetWire
0049 {
0050 public:
0051   DEFINE_STANDARD_ALLOC
0052 
0053   Standard_EXPORT BRepFill_OffsetWire();
0054 
0055   Standard_EXPORT BRepFill_OffsetWire(const TopoDS_Face&     Spine,
0056                                       const GeomAbs_JoinType Join         = GeomAbs_Arc,
0057                                       const bool             IsOpenResult = false);
0058 
0059   //! Initialize the evaluation of Offsetting.
0060   Standard_EXPORT void Init(const TopoDS_Face&     Spine,
0061                             const GeomAbs_JoinType Join         = GeomAbs_Arc,
0062                             const bool             IsOpenResult = false);
0063 
0064   //! Performs an OffsetWire at an altitude <Alt> from
0065   //! the face (According to the orientation of the
0066   //! face)
0067   Standard_EXPORT void Perform(const double Offset, const double Alt = 0.0);
0068 
0069   //! Performs an OffsetWire
0070   Standard_EXPORT void PerformWithBiLo(const TopoDS_Face&              WSP,
0071                                        const double                    Offset,
0072                                        const BRepMAT2d_BisectingLocus& Locus,
0073                                        BRepMAT2d_LinkTopoBilo&         Link,
0074                                        const GeomAbs_JoinType          Join = GeomAbs_Arc,
0075                                        const double                    Alt  = 0.0);
0076 
0077   Standard_EXPORT bool IsDone() const;
0078 
0079   Standard_EXPORT const TopoDS_Face& Spine() const;
0080 
0081   //! returns the generated shape.
0082   Standard_EXPORT const TopoDS_Shape& Shape() const;
0083 
0084   //! Returns the shapes created from a subshape
0085   //! <SpineShape> of the spine.
0086   //! Returns the last computed Offset.
0087   Standard_EXPORT const NCollection_List<TopoDS_Shape>& GeneratedShapes(
0088     const TopoDS_Shape& SpineShape);
0089 
0090   Standard_EXPORT GeomAbs_JoinType JoinType() const;
0091 
0092 private:
0093   Standard_EXPORT NCollection_IndexedDataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>>&
0094                   Generated();
0095 
0096   //! Prepare the spine as follow
0097   //! - Cut the spine-Edges at the extrema of curvature and
0098   //! at the inflexion points.
0099   Standard_EXPORT void PrepareSpine();
0100 
0101   //! Add the OffsetWire <Other> to <me> and update <myMap>
0102   Standard_EXPORT void Add(const BRepFill_OffsetWire& Other);
0103 
0104   Standard_EXPORT void UpdateDetromp(
0105     NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>>& Detromp,
0106     const TopoDS_Shape&                                                Shape1,
0107     const TopoDS_Shape&                                                Shape2,
0108     const NCollection_Sequence<TopoDS_Shape>&                          Vertices,
0109     const NCollection_Sequence<gp_Pnt>&                                Params,
0110     const Bisector_Bisec&                                              Bisec,
0111     const bool                                                         SOnE,
0112     const bool                                                         EOnE,
0113     const BRepFill_TrimEdgeTool&                                       Trim) const;
0114 
0115   //! Constructs the wires with the trimmed offset edges.
0116   Standard_EXPORT void MakeWires();
0117 
0118   //! Fix holes between open wires where it is possible
0119   Standard_EXPORT void FixHoles();
0120 
0121   TopoDS_Face                                                              mySpine;
0122   TopoDS_Face                                                              myWorkSpine;
0123   double                                                                   myOffset;
0124   bool                                                                     myIsOpenResult;
0125   TopoDS_Shape                                                             myShape;
0126   bool                                                                     myIsDone;
0127   GeomAbs_JoinType                                                         myJoinType;
0128   NCollection_IndexedDataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>> myMap;
0129   BRepMAT2d_BisectingLocus                                                 myBilo;
0130   BRepMAT2d_LinkTopoBilo                                                   myLink;
0131   NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> myMapSpine;
0132   bool                                                                     myCallGen;
0133 };
0134 
0135 #endif // _BRepFill_OffsetWire_HeaderFile