Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created: 2017-12-28 
0002 // 
0003 // Copyright (c) 2017 OPEN CASCADE SAS 
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_Triangulator_HeaderFile
0017 #define _BRepMesh_Triangulator_HeaderFile
0018 
0019 #include <gp_Pln.hxx>
0020 #include <Poly_Triangulation.hxx>
0021 #include <IMeshData_Types.hxx>
0022 #include <NCollection_Vector.hxx>
0023 #include <NCollection_List.hxx>
0024 #include <NCollection_Shared.hxx>
0025 #include <TColStd_SequenceOfInteger.hxx>
0026 #include <TColStd_DataMapOfIntegerInteger.hxx>
0027 #include <BRepMesh_DataStructureOfDelaun.hxx>
0028 
0029 class Message_Messenger;
0030 
0031 //! Auxiliary tool to generate triangulation
0032 class BRepMesh_Triangulator
0033 {
0034 public:
0035 
0036   DEFINE_STANDARD_ALLOC
0037 
0038   //! Performs conversion of the given list of triangles to Poly_Triangulation.
0039   Standard_EXPORT static Handle(Poly_Triangulation) ToPolyTriangulation(
0040     const TColgp_Array1OfPnt&              theNodes,
0041     const NCollection_List<Poly_Triangle>& thePolyTriangles);
0042 
0043 public:
0044 
0045   //! Constructor. Initialized tool by the given parameters.
0046   Standard_EXPORT BRepMesh_Triangulator (
0047     const NCollection_Vector<gp_XYZ>&                  theXYZs,
0048     const NCollection_List<TColStd_SequenceOfInteger>& theWires,
0049     const gp_Dir&                                      theNorm);
0050 
0051   //! Performs triangulation of source wires and stores triangles the output list.
0052   Standard_EXPORT Standard_Boolean Perform (NCollection_List<Poly_Triangle>& thePolyTriangles);
0053 
0054   //! Set messenger for output information
0055   //! without this Message::DefaultMessenger() will be used
0056   void SetMessenger(const Handle(Message_Messenger)& theMess)
0057   {
0058     myMess = theMess;
0059   }
0060 
0061   BRepMesh_Triangulator& operator =(const BRepMesh_Triangulator& theOther);
0062 
0063 private:
0064 
0065   // auxiliary for makeTrianglesUsingBRepMesh
0066   void addTriange34 (
0067     const TColStd_SequenceOfInteger&  theW,
0068     NCollection_List<Poly_Triangle>&  thePolyTriangles);
0069 
0070   // auxiliary for addTriange34
0071   Standard_Boolean checkCondition(
0072     const int                       (&theNodes)[4],
0073     const TColStd_SequenceOfInteger&  theWire);
0074 
0075   // performs initialization of mesh data structure.
0076   Standard_Boolean prepareMeshStructure();
0077 
0078   // auxiliary for triangulation
0079   Standard_Boolean triangulate (NCollection_List<Poly_Triangle>& thePolyTriangles);
0080 
0081 private:
0082 
0083   const NCollection_Vector<gp_XYZ>&                  myXYZs;
0084   const NCollection_List<TColStd_SequenceOfInteger>& myWires;
0085   gp_Pln                                             myPlane;
0086   Handle(Message_Messenger)                          myMess;
0087 
0088   Handle(BRepMesh_DataStructureOfDelaun)             myMeshStructure;
0089   TColStd_DataMapOfIntegerInteger                    myTmpMap;
0090   Handle(IMeshData::VectorOfInteger)                 myIndices;
0091 };
0092 
0093 #endif // _BRepMesh_Triangulator_HeaderFile