Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-04 09:15:55

0001 // Created on: 1998-06-03
0002 // Created by: data exchange team
0003 // Copyright (c) 1998-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 _ShapeFix_HeaderFile
0018 #define _ShapeFix_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Real.hxx>
0025 
0026 #include <ShapeExtend_BasicMsgRegistrator.hxx>
0027 #include <Message_ProgressRange.hxx>
0028 
0029 class TopoDS_Shape;
0030 class ShapeExtend_BasicMsgRegistrator;
0031 class ShapeBuild_ReShape;
0032 
0033 //! This package provides algorithms for fixing
0034 //! problematic (violating Open CASCADE requirements) shapes.
0035 //! Tools from package ShapeAnalysis are used for detecting the problems. The
0036 //! detecting and fixing is done taking in account various
0037 //! criteria implemented in BRepCheck package.
0038 //! Each class of package ShapeFix deals with one
0039 //! certain type of shapes or with some family of problems.
0040 class ShapeFix
0041 {
0042 public:
0043   DEFINE_STANDARD_ALLOC
0044 
0045   //! Runs SameParameter from BRepLib with these adaptations :
0046   //! <enforce> forces computations, else they are made only on
0047   //! Edges with flag SameParameter false
0048   //! <preci>, if not precised, is taken for each EDge as its own
0049   //! Tolerance
0050   //! Returns True when done, False if an exception has been raised
0051   //! In case of exception anyway, as many edges as possible have
0052   //! been processed. The passed progress indicator allows user
0053   //! to consult the current progress stage and abort algorithm
0054   //! if needed.
0055   Standard_EXPORT static bool SameParameter(
0056     const TopoDS_Shape&                                 shape,
0057     const bool                                          enforce,
0058     const double                                        preci       = 0.0,
0059     const Message_ProgressRange&                        theProgress = Message_ProgressRange(),
0060     const occ::handle<ShapeExtend_BasicMsgRegistrator>& theMsgReg   = nullptr);
0061 
0062   //! Runs EncodeRegularity from BRepLib taking into account
0063   //! shared components of assemblies, so that each component
0064   //! is processed only once
0065   Standard_EXPORT static void EncodeRegularity(const TopoDS_Shape& shape,
0066                                                const double        tolang = 1.0e-10);
0067 
0068   //! Removes edges which are less than given tolerance from shape
0069   //! with help of ShapeFix_Wire::FixSmall()
0070   Standard_EXPORT static TopoDS_Shape RemoveSmallEdges(TopoDS_Shape&                    shape,
0071                                                        const double                     Tolerance,
0072                                                        occ::handle<ShapeBuild_ReShape>& context);
0073 
0074   //! Fix position of the vertices having tolerance more tnan specified one.;
0075   Standard_EXPORT static bool FixVertexPosition(TopoDS_Shape&                          theshape,
0076                                                 const double                           theTolerance,
0077                                                 const occ::handle<ShapeBuild_ReShape>& thecontext);
0078 
0079   //! Calculate size of least edge;
0080   Standard_EXPORT static double LeastEdgeSize(TopoDS_Shape& theshape);
0081 };
0082 
0083 #endif // _ShapeFix_HeaderFile