Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:14

0001 // Created on: 2016-04-19
0002 // Copyright (c) 2016 OPEN CASCADE SAS
0003 // Created by: Oleg AGASHIN
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _BRepMesh_EdgeDiscret_HeaderFile
0017 #define _BRepMesh_EdgeDiscret_HeaderFile
0018 
0019 #include <IMeshTools_ModelAlgo.hxx>
0020 #include <IMeshTools_Parameters.hxx>
0021 #include <IMeshData_Types.hxx>
0022 
0023 class IMeshTools_CurveTessellator;
0024 
0025 //! Class implements functionality of edge discret tool.
0026 //! Performs check of the edges for existing Poly_PolygonOnTriangulation.
0027 //! In case if it fits specified deflection, restores data structure using
0028 //! it, else clears edges from outdated data.
0029 class BRepMesh_EdgeDiscret : public IMeshTools_ModelAlgo
0030 {
0031 public:
0032   //! Constructor.
0033   Standard_EXPORT BRepMesh_EdgeDiscret ();
0034 
0035   //! Destructor.
0036   Standard_EXPORT virtual ~BRepMesh_EdgeDiscret ();
0037 
0038   //! Creates instance of free edge tessellator.
0039   Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator(
0040     const IMeshData::IEdgeHandle& theDEdge,
0041     const IMeshTools_Parameters&  theParameters,
0042     const Standard_Integer        theMinPointsNb = 2);
0043 
0044   //! Creates instance of edge tessellator.
0045   Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellator(
0046     const IMeshData::IEdgeHandle& theDEdge,
0047     const TopAbs_Orientation      theOrientation,
0048     const IMeshData::IFaceHandle& theDFace,
0049     const IMeshTools_Parameters&  theParameters,
0050     const Standard_Integer        theMinPointsNb = 2);
0051 
0052   //! Creates instance of tessellation extractor.
0053   Standard_EXPORT static Handle(IMeshTools_CurveTessellator) CreateEdgeTessellationExtractor(
0054     const IMeshData::IEdgeHandle& theDEdge,
0055     const IMeshData::IFaceHandle& theDFace);
0056 
0057   //! Functor API to discretize the given edge.
0058   void operator() (const Standard_Integer theEdgeIndex) const {
0059     process (theEdgeIndex);
0060   }
0061 
0062   //! Updates 3d discrete edge model using the given tessellation tool.
0063   Standard_EXPORT static void Tessellate3d(
0064     const IMeshData::IEdgeHandle&              theDEdge,
0065     const Handle(IMeshTools_CurveTessellator)& theTessellator,
0066     const Standard_Boolean                     theUpdateEnds);
0067 
0068   //! Updates 2d discrete edge model using tessellation of 3D curve.
0069   Standard_EXPORT static void Tessellate2d(
0070     const IMeshData::IEdgeHandle& theDEdge,
0071     const Standard_Boolean        theUpdateEnds);
0072 
0073   DEFINE_STANDARD_RTTIEXT(BRepMesh_EdgeDiscret, IMeshTools_ModelAlgo)
0074 
0075 protected:
0076 
0077   //! Performs processing of edges of the given model.
0078   Standard_EXPORT virtual Standard_Boolean performInternal (
0079     const Handle (IMeshData_Model)& theModel,
0080     const IMeshTools_Parameters&    theParameters,
0081     const Message_ProgressRange&    theRange) Standard_OVERRIDE;
0082 
0083 private:
0084 
0085   //! Checks existing discretization of the edge and updates data model.
0086   void process (const Standard_Integer theEdgeIndex) const;
0087 
0088   //! Checks existing polygon on triangulation does it fit edge deflection or not.
0089   //! @return deflection of polygon or RealLast () in case if edge has no polygon 
0090   //! or it was dropped.
0091   Standard_Real checkExistingPolygonAndUpdateStatus(
0092     const IMeshData::IEdgeHandle&   theDEdge,
0093     const IMeshData::IPCurveHandle& thePCurve) const;
0094 
0095 private:
0096 
0097   Handle (IMeshData_Model) myModel;
0098   IMeshTools_Parameters    myParameters;
0099 };
0100 
0101 #endif