Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 09:17:10

0001 // Created on: 1995-05-02
0002 // Created by: Jing Cheng MEI
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_FindContigousEdges_HeaderFile
0018 #define _BRepOffsetAPI_FindContigousEdges_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <TopoDS_Shape.hxx>
0026 #include <NCollection_List.hxx>
0027 class BRepBuilderAPI_Sewing;
0028 class TopoDS_Shape;
0029 class TopoDS_Edge;
0030 
0031 //! Provides methods to identify contiguous boundaries for continuity control (C0, C1, ...)
0032 //!
0033 //! Use this function as following:
0034 //! - create an object
0035 //! - default tolerance 1.E-06
0036 //! - with analysis of degenerated faces on
0037 //! - define if necessary a new tolerance
0038 //! - set if necessary analysis of degenerated shapes off
0039 //! - add shapes to be controlled -> Add
0040 //! - compute -> Perform
0041 //! - output couples of connected edges for control
0042 //! - output the problems if any
0043 class BRepOffsetAPI_FindContigousEdges
0044 {
0045 public:
0046   DEFINE_STANDARD_ALLOC
0047 
0048   //! Initializes an algorithm for identifying contiguous edges
0049   //! on shapes with tolerance as the tolerance of contiguity
0050   //! (defaulted to 1.0e-6). This tolerance value is used to
0051   //! determine whether two edges or sections of edges are coincident.
0052   //! Use the function Add to define the shapes to be checked.
0053   //! Set option to false. This argument (defaulted to true) will
0054   //! serve in subsequent software releases for performing an
0055   //! analysis of degenerated shapes.
0056   Standard_EXPORT BRepOffsetAPI_FindContigousEdges(const double tolerance = 1.0e-06,
0057                                                    const bool   option    = true);
0058 
0059   //! Initializes this algorithm for identifying contiguous edges
0060   //! on shapes using the tolerance of contiguity tolerance.
0061   //! This tolerance value is used to determine whether two
0062   //! edges or sections of edges are coincident.
0063   //! Use the function Add to define the shapes to be checked.
0064   //! Sets <option> to false.
0065   Standard_EXPORT void Init(const double tolerance, const bool option);
0066 
0067   //! Adds the shape shape to the list of shapes to be
0068   //! checked by this algorithm.
0069   //! Once all the shapes to be checked have been added,
0070   //! use the function Perform to find the contiguous edges
0071   //! and the function ContigousEdge to return these edges.
0072   Standard_EXPORT void Add(const TopoDS_Shape& shape);
0073 
0074   //! Finds coincident parts of edges of two or more shapes
0075   //! added to this algorithm and breaks down these edges
0076   //! into contiguous and non-contiguous sections on copies
0077   //! of the initial shapes.
0078   //! The function ContigousEdge returns contiguous
0079   //! edges. The function Modified can be used to return
0080   //! modified copies of the initial shapes where one or more
0081   //! edges were broken down into contiguous and non-contiguous sections.
0082   //! Warning
0083   //! This function must be used once all the shapes to be
0084   //! checked have been added. It is not possible to add
0085   //! further shapes subsequently and then to repeat the call to Perform.
0086   Standard_EXPORT void Perform();
0087 
0088   //! Gives the number of edges (free edges + contiguous edges + multiple edge)
0089   Standard_EXPORT int NbEdges() const;
0090 
0091   //! Returns the number of contiguous edges found by the
0092   //! function Perform on the shapes added to this algorithm.
0093   Standard_EXPORT int NbContigousEdges() const;
0094 
0095   //! Returns the contiguous edge of index index found by
0096   //! the function Perform on the shapes added to this algorithm.
0097   //! Exceptions
0098   //! Standard_OutOfRange if:
0099   //! - index is less than 1, or
0100   //! - index is greater than the number of contiguous
0101   //! edges found by the function Perform on the shapes added to this algorithm.
0102   Standard_EXPORT const TopoDS_Edge& ContigousEdge(const int index) const;
0103 
0104   //! Returns a list of edges coincident with the contiguous
0105   //! edge of index index found by the function Perform.
0106   //! There are as many edges in the list as there are faces
0107   //! adjacent to this contiguous edge.
0108   //! Exceptions
0109   //! Standard_OutOfRange if:
0110   //! - index is less than 1, or
0111   //! - index is greater than the number of contiguous edges
0112   //! found by the function Perform on the shapes added to this algorithm.
0113   Standard_EXPORT const NCollection_List<TopoDS_Shape>& ContigousEdgeCouple(const int index) const;
0114 
0115   //! Returns the edge on the initial shape, of which the
0116   //! modified copy contains the edge section.
0117   //! section is coincident with a contiguous edge found by
0118   //! the function Perform. Use the function
0119   //! ContigousEdgeCouple to obtain a valid section.
0120   //! This information is useful for verification purposes, since
0121   //! it provides a means of determining the surface to which
0122   //! the contiguous edge belongs.
0123   //! Exceptions
0124   //! Standard_NoSuchObject if section is not coincident
0125   //! with a contiguous edge. Use the function
0126   //! ContigousEdgeCouple to obtain a valid section.
0127   Standard_EXPORT const TopoDS_Edge& SectionToBoundary(const TopoDS_Edge& section) const;
0128 
0129   //! Gives the number of degenerated shapes
0130   Standard_EXPORT int NbDegeneratedShapes() const;
0131 
0132   //! Gives a degenerated shape
0133   Standard_EXPORT const TopoDS_Shape& DegeneratedShape(const int index) const;
0134 
0135   //! Indicates if a input shape is degenerated
0136   Standard_EXPORT bool IsDegenerated(const TopoDS_Shape& shape) const;
0137 
0138   //! Returns true if the copy of the initial shape shape was
0139   //! modified by the function Perform (i.e. if one or more of
0140   //! its edges was broken down into contiguous and non-contiguous sections).
0141   //! Warning
0142   //! Returns false if shape is not one of the initial shapes
0143   //! added to this algorithm.
0144   Standard_EXPORT bool IsModified(const TopoDS_Shape& shape) const;
0145 
0146   //! Gives a modifieded shape
0147   //! Raises NoSuchObject if shape has not been modified
0148   Standard_EXPORT const TopoDS_Shape& Modified(const TopoDS_Shape& shape) const;
0149 
0150   //! Dump properties of resulting shape.
0151   Standard_EXPORT void Dump() const;
0152 
0153 private:
0154   occ::handle<BRepBuilderAPI_Sewing> mySewing;
0155 };
0156 
0157 #endif // _BRepOffsetAPI_FindContigousEdges_HeaderFile