File indexing completed on 2025-01-18 10:03:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _BRepMesh_VertexTool_HeaderFile
0015 #define _BRepMesh_VertexTool_HeaderFile
0016
0017 #include <Standard_Transient.hxx>
0018 #include <BRepMesh_VertexInspector.hxx>
0019 #include <Standard_OStream.hxx>
0020 #include <gp_XY.hxx>
0021 #include <IMeshData_Types.hxx>
0022
0023
0024
0025
0026
0027 class BRepMesh_VertexTool : public Standard_Transient
0028 {
0029 public:
0030
0031
0032
0033 Standard_EXPORT BRepMesh_VertexTool(
0034 const Handle(NCollection_IncAllocator)& theAllocator);
0035
0036
0037 void SetCellSize(const Standard_Real theSize)
0038 {
0039 myCellFilter.Reset(theSize, myAllocator);
0040 mySelector.Clear();
0041 }
0042
0043
0044
0045
0046 void SetCellSize(const Standard_Real theSizeX,
0047 const Standard_Real theSizeY)
0048 {
0049 Standard_Real aCellSizeC[2] = { theSizeX, theSizeY };
0050 NCollection_Array1<Standard_Real> aCellSize(aCellSizeC[0], 1, 2);
0051 myCellFilter.Reset(aCellSize, myAllocator);
0052 mySelector.Clear();
0053 }
0054
0055
0056
0057 void SetTolerance(const Standard_Real theTolerance)
0058 {
0059 mySelector.SetTolerance( theTolerance );
0060 myTolerance[0] = theTolerance;
0061 myTolerance[1] = theTolerance;
0062 }
0063
0064
0065
0066
0067
0068 void SetTolerance(const Standard_Real theToleranceX,
0069 const Standard_Real theToleranceY)
0070 {
0071 mySelector.SetTolerance( theToleranceX, theToleranceY );
0072 myTolerance[0] = theToleranceX;
0073 myTolerance[1] = theToleranceY;
0074 }
0075
0076
0077
0078
0079
0080 void GetTolerance(Standard_Real& theToleranceX,
0081 Standard_Real& theToleranceY)
0082 {
0083 theToleranceX = myTolerance[0];
0084 theToleranceY = myTolerance[1];
0085 }
0086
0087
0088
0089
0090
0091
0092 Standard_EXPORT Standard_Integer Add(
0093 const BRepMesh_Vertex& theVertex,
0094 const Standard_Boolean isForceAdd);
0095
0096
0097 Standard_EXPORT void DeleteVertex(const Standard_Integer theIndex);
0098
0099
0100 const Handle(IMeshData::VectorOfVertex)& Vertices() const
0101 {
0102 return mySelector.Vertices();
0103 }
0104
0105
0106 Handle(IMeshData::VectorOfVertex)& ChangeVertices()
0107 {
0108 return mySelector.ChangeVertices();
0109 }
0110
0111
0112 const BRepMesh_Vertex& FindKey(const Standard_Integer theIndex)
0113 {
0114 return mySelector.GetVertex(theIndex);
0115 }
0116
0117
0118 Standard_Integer FindIndex(const BRepMesh_Vertex& theVertex)
0119 {
0120 mySelector.SetPoint(theVertex.Coord());
0121 myCellFilter.Inspect (theVertex.Coord(), mySelector);
0122 return mySelector.GetCoincidentPoint();
0123 }
0124
0125
0126 Standard_Integer Extent() const
0127 {
0128 return mySelector.NbVertices();
0129 }
0130
0131
0132 Standard_Boolean IsEmpty() const
0133 {
0134 return (Extent() == 0);
0135 }
0136
0137
0138
0139
0140 Standard_EXPORT void Substitute(const Standard_Integer theIndex,
0141 const BRepMesh_Vertex& theVertex);
0142
0143
0144 void RemoveLast()
0145 {
0146 DeleteVertex(Extent());
0147 }
0148
0149
0150
0151 const IMeshData::ListOfInteger& GetListOfDelNodes() const
0152 {
0153 return mySelector.GetListOfDelPoints();
0154 }
0155
0156
0157 Standard_EXPORT void Statistics(Standard_OStream& theStream) const;
0158
0159 DEFINE_STANDARD_RTTIEXT(BRepMesh_VertexTool, Standard_Transient)
0160
0161 private:
0162
0163
0164
0165
0166
0167 void expandPoint(const gp_XY& thePoint,
0168 gp_XY& theMinPoint,
0169 gp_XY& theMaxPoint)
0170 {
0171 theMinPoint.SetX(thePoint.X() - myTolerance[0]);
0172 theMinPoint.SetY(thePoint.Y() - myTolerance[1]);
0173 theMaxPoint.SetX(thePoint.X() + myTolerance[0]);
0174 theMaxPoint.SetY(thePoint.Y() + myTolerance[1]);
0175 }
0176
0177 private:
0178
0179 Handle(NCollection_IncAllocator) myAllocator;
0180 IMeshData::VertexCellFilter myCellFilter;
0181 BRepMesh_VertexInspector mySelector;
0182 Standard_Real myTolerance[2];
0183 };
0184
0185 #endif