Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:15:48

0001 // Created on: 2011-11-24
0002 // Created by: ANNA MASALSKAYA
0003 // Copyright (c) 2011-2014 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 BRepBuilderAPI_VertexInspector_HeaderFile
0017 #define BRepBuilderAPI_VertexInspector_HeaderFile
0018 
0019 #include <Standard_Integer.hxx>
0020 #include <NCollection_List.hxx>
0021 #include <NCollection_DynamicArray.hxx>
0022 #include <gp_XYZ.hxx>
0023 #include <NCollection_CellFilter.hxx>
0024 
0025 typedef NCollection_DynamicArray<gp_XYZ> VectorOfPoint;
0026 
0027 //! Inspector for CellFilter algorithm working with gp_XYZ points in 3d space.
0028 //! Used in search of coincidence points with a certain tolerance.
0029 
0030 class BRepBuilderAPI_VertexInspector
0031 {
0032 public:
0033   static constexpr int Dimension = 3;
0034 
0035   typedef gp_XYZ Point;
0036   typedef int    Target;
0037 
0038   static double Coord(int i, const Point& thePnt) { return thePnt.Coord(i + 1); }
0039 
0040   static Point Shift(const Point& thePnt, double theTol)
0041   {
0042     return Point(thePnt.X() + theTol, thePnt.Y() + theTol, thePnt.Z() + theTol);
0043   }
0044 
0045   //! Constructor; remembers the tolerance
0046   BRepBuilderAPI_VertexInspector(const double theTol)
0047       : myTol(theTol * theTol)
0048   {
0049   }
0050 
0051   //! Keep the points used for comparison
0052   void Add(const gp_XYZ& thePnt) { myPoints.Append(thePnt); }
0053 
0054   //! Clear the list of adjacent points
0055   void ClearResList() { myResInd.Clear(); }
0056 
0057   //! Set current point to search for coincidence
0058   void SetCurrent(const gp_XYZ& theCurPnt) { myCurrent = theCurPnt; }
0059 
0060   //! Get list of indexes of points adjacent with the current
0061   const NCollection_List<int>& ResInd() { return myResInd; }
0062 
0063   //! Implementation of inspection method
0064   Standard_EXPORT NCollection_CellFilter_Action Inspect(const int theTarget);
0065 
0066 private:
0067   double                myTol;
0068   NCollection_List<int> myResInd;
0069   VectorOfPoint         myPoints;
0070   gp_XYZ                myCurrent;
0071 };
0072 
0073 #endif