Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-06 08:32:00

0001 // Created on: 1996-02-13
0002 // Created by: Yves FRICAUD
0003 // Copyright (c) 1996-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_MakeOffsetShape_HeaderFile
0018 #define _BRepOffsetAPI_MakeOffsetShape_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepOffset_MakeOffset.hxx>
0025 #include <BRepOffset_MakeSimpleOffset.hxx>
0026 #include <BRepBuilderAPI_MakeShape.hxx>
0027 #include <BRepOffset_Mode.hxx>
0028 #include <GeomAbs_JoinType.hxx>
0029 #include <TopTools_ListOfShape.hxx>
0030 class TopoDS_Shape;
0031 
0032 //! Describes functions to build a shell out of a shape. The
0033 //! result is an unlooped shape parallel to the source shape.
0034 //! A MakeOffsetShape object provides a framework for:
0035 //! - defining the construction of a shell
0036 //! - implementing the construction algorithm
0037 //! - consulting the result.
0038 class BRepOffsetAPI_MakeOffsetShape : public BRepBuilderAPI_MakeShape
0039 {
0040 public:
0041   DEFINE_STANDARD_ALLOC
0042 
0043   //! Constructor does nothing.
0044   Standard_EXPORT BRepOffsetAPI_MakeOffsetShape();
0045 
0046   //! Constructs offset shape for the given one using simple algorithm without intersections
0047   //! computation.
0048   Standard_EXPORT void PerformBySimple(const TopoDS_Shape& theS,
0049                                        const Standard_Real theOffsetValue);
0050 
0051   //! Constructs a shape parallel to the shape S, where
0052   //! - S may be a face, a shell, a solid or a compound of these shape kinds;
0053   //! - Offset is the offset value. The offset shape is constructed:
0054   //! - outside S, if Offset is positive,
0055   //! - inside S, if Offset is negative;
0056   //! - Tol defines the coincidence tolerance criterion for generated shapes;
0057   //! - Mode defines the construction type of parallels
0058   //! applied to the free edges of shape S; currently, only one
0059   //! construction type is implemented, namely the one where the free
0060   //! edges do not generate parallels; this corresponds to the default
0061   //! value BRepOffset_Skin;
0062   //! - Intersection specifies how the algorithm must work in
0063   //! order to limit the parallels to two adjacent shapes:
0064   //! - if Intersection is false (default value), the intersection
0065   //! is calculated with the parallels to the two adjacent shapes,
0066   //! - if Intersection is true, the intersection is calculated by
0067   //! taking all generated parallels into account; this computation method is
0068   //! more general as it avoids some self-intersections generated in the
0069   //! offset shape from features of small dimensions on shape S, however this
0070   //! method has not been completely implemented and therefore is not
0071   //! recommended for use;
0072   //! - SelfInter tells the algorithm whether a computation
0073   //! to eliminate self-intersections must be applied to the resulting
0074   //! shape; however, as this functionality is not yet
0075   //! implemented, it is recommended to use the default value (false);
0076   //! - Join defines how to fill the holes that may appear between
0077   //! parallels to the two adjacent faces. It may take values
0078   //! GeomAbs_Arc or GeomAbs_Intersection:
0079   //! - if Join is equal to GeomAbs_Arc, then pipes are generated
0080   //! between two free edges of two adjacent parallels,
0081   //! and spheres are generated on "images" of vertices;
0082   //! it is the default value,
0083   //! - if Join is equal to GeomAbs_Intersection, then the parallels to the
0084   //! two adjacent faces are enlarged and intersected,
0085   //! so that there are no free edges on parallels to faces.
0086   //! RemoveIntEdges flag defines whether to remove the INTERNAL edges
0087   //! from the result or not.
0088   //! Warnings
0089   //! 1. All the faces of the shape S should be based on the surfaces
0090   //! with continuity at least C1.
0091   //! 2. The offset value should be sufficiently small to avoid
0092   //! self-intersections in resulting shape. Otherwise these
0093   //! self-intersections may appear inside an offset face if its
0094   //! initial surface is not plane or sphere or cylinder, also some
0095   //! non-adjacent offset faces may intersect each other. Also, some
0096   //! offset surfaces may "turn inside out".
0097   //! 3. The algorithm may fail if the shape S contains vertices where
0098   //! more than 3 edges converge.
0099   //! 4. Since 3d-offset algorithm involves intersection of surfaces,
0100   //! it is under limitations of surface intersection algorithm.
0101   //! 5. A result cannot be generated if the underlying geometry of S is
0102   //! BSpline with continuity C0.
0103   //! Exceptions
0104   //! Geom_UndefinedDerivative if the underlying
0105   //! geometry of S is BSpline with continuity C0.
0106   Standard_EXPORT void PerformByJoin(
0107     const TopoDS_Shape&          S,
0108     const Standard_Real          Offset,
0109     const Standard_Real          Tol,
0110     const BRepOffset_Mode        Mode           = BRepOffset_Skin,
0111     const Standard_Boolean       Intersection   = Standard_False,
0112     const Standard_Boolean       SelfInter      = Standard_False,
0113     const GeomAbs_JoinType       Join           = GeomAbs_Arc,
0114     const Standard_Boolean       RemoveIntEdges = Standard_False,
0115     const Message_ProgressRange& theRange       = Message_ProgressRange());
0116 
0117   //! Returns instance of the underlying intersection / arc algorithm.
0118   Standard_EXPORT virtual const BRepOffset_MakeOffset& MakeOffset() const;
0119 
0120   //! Does nothing.
0121   Standard_EXPORT virtual void Build(
0122     const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0123 
0124   //! Returns the list of shapes generated from the shape <S>.
0125   Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& S)
0126     Standard_OVERRIDE;
0127 
0128   //! Returns the list of shapes Modified from the shape <S>.
0129   Standard_EXPORT virtual const TopTools_ListOfShape& Modified(const TopoDS_Shape& S)
0130     Standard_OVERRIDE;
0131 
0132   //! Returns true if the shape has been removed from the result.
0133   Standard_EXPORT virtual Standard_Boolean IsDeleted(const TopoDS_Shape& S) Standard_OVERRIDE;
0134 
0135   //! Returns offset join type.
0136   Standard_EXPORT GeomAbs_JoinType GetJoinType() const;
0137 
0138 protected:
0139   enum OffsetAlgo_Type
0140   {
0141     OffsetAlgo_NONE,
0142     OffsetAlgo_JOIN,
0143     OffsetAlgo_SIMPLE
0144   };
0145 
0146   OffsetAlgo_Type myLastUsedAlgo;
0147 
0148   BRepOffset_MakeOffset       myOffsetShape;
0149   BRepOffset_MakeSimpleOffset mySimpleOffsetShape;
0150 };
0151 
0152 #endif // _BRepOffsetAPI_MakeOffsetShape_HeaderFile