File indexing completed on 2026-07-29 09:14:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef BRepMesh_CircleInspector_HeaderFile
0017 #define BRepMesh_CircleInspector_HeaderFile
0018
0019 #include <IMeshData_Types.hxx>
0020 #include <BRepMesh_Circle.hxx>
0021 #include <gp_XY.hxx>
0022 #include <NCollection_CellFilter.hxx>
0023
0024
0025 class BRepMesh_CircleInspector : public NCollection_CellFilter_InspectorXY
0026 {
0027 public:
0028 typedef Standard_Integer Target;
0029
0030
0031
0032
0033
0034 BRepMesh_CircleInspector(const Standard_Real theTolerance,
0035 const Standard_Integer theReservedSize,
0036 const Handle(NCollection_IncAllocator)& theAllocator)
0037 : mySqTolerance(theTolerance * theTolerance),
0038 myResIndices(theAllocator),
0039 myCircles(theReservedSize, theAllocator)
0040 {
0041 }
0042
0043
0044
0045
0046 void Bind(const Standard_Integer theIndex, const BRepMesh_Circle& theCircle)
0047 {
0048 myCircles.SetValue(theIndex, theCircle);
0049 }
0050
0051
0052 const IMeshData::VectorOfCircle& Circles() const { return myCircles; }
0053
0054
0055
0056
0057 BRepMesh_Circle& Circle(const Standard_Integer theIndex) { return myCircles(theIndex); }
0058
0059
0060
0061 void SetPoint(const gp_XY& thePoint)
0062 {
0063 myResIndices.Clear();
0064 myPoint = thePoint;
0065 }
0066
0067
0068 IMeshData::ListOfInteger& GetShotCircles() { return myResIndices; }
0069
0070
0071
0072
0073 NCollection_CellFilter_Action Inspect(const Standard_Integer theTargetIndex)
0074 {
0075 BRepMesh_Circle& aCircle = myCircles(theTargetIndex);
0076 const Standard_Real& aRadius = aCircle.Radius();
0077 if (aRadius < 0.)
0078 return CellFilter_Purge;
0079
0080 gp_XY& aLoc = const_cast<gp_XY&>(aCircle.Location());
0081
0082 const Standard_Real aDX = myPoint.ChangeCoord(1) - aLoc.ChangeCoord(1);
0083 const Standard_Real aDY = myPoint.ChangeCoord(2) - aLoc.ChangeCoord(2);
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102 if ((aDX * aDX + aDY * aDY) - (aRadius * aRadius) <= mySqTolerance)
0103 myResIndices.Append(theTargetIndex);
0104
0105 return CellFilter_Keep;
0106 }
0107
0108
0109 static Standard_Boolean IsEqual(const Standard_Integer theIndex,
0110 const Standard_Integer theTargetIndex)
0111 {
0112 return (theIndex == theTargetIndex);
0113 }
0114
0115 private:
0116 Standard_Real mySqTolerance;
0117 IMeshData::ListOfInteger myResIndices;
0118 IMeshData::VectorOfCircle myCircles;
0119 gp_XY myPoint;
0120 };
0121
0122 #endif