Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-24 09:16:03

0001 // Created on: 1995-09-18
0002 // Created by: Bruno DUMORTIER
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 _BRepOffsetAPI_MakeOffset_HeaderFile
0018 #define _BRepOffsetAPI_MakeOffset_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <TopoDS_Face.hxx>
0024 #include <TopTools_ListOfShape.hxx>
0025 #include <BRepFill_ListOfOffsetWire.hxx>
0026 #include <BRepBuilderAPI_MakeShape.hxx>
0027 class TopoDS_Wire;
0028 class TopoDS_Shape;
0029 
0030 //! Describes algorithms for offsetting wires from a set of
0031 //! wires contained in a planar face.
0032 //! A MakeOffset object provides a framework for:
0033 //! - defining the construction of an offset,
0034 //! - implementing the construction algorithm, and
0035 //! - consulting the result.
0036 class BRepOffsetAPI_MakeOffset : public BRepBuilderAPI_MakeShape
0037 {
0038 public:
0039   DEFINE_STANDARD_ALLOC
0040 
0041   //! Constructs an algorithm for creating an empty offset
0042   Standard_EXPORT BRepOffsetAPI_MakeOffset();
0043 
0044   //! Constructs an algorithm for creating an algorithm
0045   //! to build parallels to the spine Spine
0046   Standard_EXPORT BRepOffsetAPI_MakeOffset(const TopoDS_Face&     Spine,
0047                                            const GeomAbs_JoinType Join         = GeomAbs_Arc,
0048                                            const Standard_Boolean IsOpenResult = Standard_False);
0049 
0050   //! Initializes the algorithm to construct parallels to the spine Spine.
0051   //! Join defines the type of parallel generated by the
0052   //! salient vertices of the spine.
0053   //! The default type is GeomAbs_Arc where the vertices generate
0054   //! sections of a circle.
0055   //! If join type is GeomAbs_Intersection, the edges that
0056   //! intersect in a salient vertex generate the edges
0057   //! prolonged until intersection.
0058   Standard_EXPORT void Init(const TopoDS_Face&     Spine,
0059                             const GeomAbs_JoinType Join         = GeomAbs_Arc,
0060                             const Standard_Boolean IsOpenResult = Standard_False);
0061 
0062   Standard_EXPORT BRepOffsetAPI_MakeOffset(const TopoDS_Wire&     Spine,
0063                                            const GeomAbs_JoinType Join         = GeomAbs_Arc,
0064                                            const Standard_Boolean IsOpenResult = Standard_False);
0065 
0066   //! Initialize the evaluation of Offsetting.
0067   Standard_EXPORT void Init(const GeomAbs_JoinType Join         = GeomAbs_Arc,
0068                             const Standard_Boolean IsOpenResult = Standard_False);
0069 
0070   //! Set approximation flag
0071   //! for conversion input contours into ones consisting of
0072   //! 2D circular arcs and 2D linear segments only.
0073   Standard_EXPORT void SetApprox(const Standard_Boolean ToApprox);
0074 
0075   //! Initializes the algorithm to construct parallels to the wire Spine.
0076   Standard_EXPORT void AddWire(const TopoDS_Wire& Spine);
0077 
0078   //! Computes a parallel to the spine at distance Offset and
0079   //! at an altitude Alt from the plane of the spine in relation
0080   //! to the normal to the spine.
0081   //! Exceptions: StdFail_NotDone if the offset is not built.
0082   Standard_EXPORT void Perform(const Standard_Real Offset, const Standard_Real Alt = 0.0);
0083 
0084   //! Builds the resulting shape (redefined from MakeShape).
0085   Standard_EXPORT virtual void Build(
0086     const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0087 
0088   //! returns a list of the created shapes
0089   //! from the shape <S>.
0090   Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& S)
0091     Standard_OVERRIDE;
0092 
0093   //! Converts each wire of the face into contour consisting only of
0094   //! arcs and segments. New 3D curves are built too.
0095   Standard_EXPORT static TopoDS_Face ConvertFace(const TopoDS_Face&  theFace,
0096                                                  const Standard_Real theAngleTolerance);
0097 
0098 protected:
0099 private:
0100   Standard_Boolean          myIsInitialized;
0101   Standard_Boolean          myLastIsLeft;
0102   GeomAbs_JoinType          myJoin;
0103   Standard_Boolean          myIsOpenResult;
0104   Standard_Boolean          myIsToApprox;
0105   TopoDS_Face               myFace;
0106   TopTools_ListOfShape      myWires;
0107   BRepFill_ListOfOffsetWire myLeft;
0108   BRepFill_ListOfOffsetWire myRight;
0109 };
0110 
0111 #endif // _BRepOffsetAPI_MakeOffset_HeaderFile