File indexing completed on 2025-01-18 10:04:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef _SelectBasics_PickResult_HeaderFile
0017 #define _SelectBasics_PickResult_HeaderFile
0018
0019 #include <gp_Pnt.hxx>
0020
0021
0022
0023 struct SelectBasics_PickResult
0024 {
0025 public:
0026
0027 static const SelectBasics_PickResult& Min (const SelectBasics_PickResult& thePickResult1,
0028 const SelectBasics_PickResult& thePickResult2)
0029 {
0030 return thePickResult1.Depth() <= thePickResult2.Depth() ? thePickResult1 : thePickResult2;
0031 }
0032
0033 public:
0034
0035 SelectBasics_PickResult()
0036 : myObjPickedPnt (RealLast(), 0.0, 0.0),
0037 myDepth (RealLast()),
0038 myDistToCenter (RealLast()) {}
0039
0040
0041 SelectBasics_PickResult (Standard_Real theDepth,
0042 Standard_Real theDistToCenter,
0043 const gp_Pnt& theObjPickedPnt)
0044 : myObjPickedPnt (theObjPickedPnt),
0045 myDepth (theDepth),
0046 myDistToCenter (theDistToCenter) {}
0047
0048 public:
0049
0050
0051 Standard_Boolean IsValid() const { return myDepth != RealLast(); }
0052
0053
0054 void Invalidate()
0055 {
0056 myDepth = RealLast();
0057 myObjPickedPnt = gp_Pnt (RealLast(), 0.0, 0.0);
0058 myNormal.SetValues (0.0f, 0.0f, 0.0f);
0059 }
0060
0061
0062 Standard_Real Depth() const { return myDepth; }
0063
0064
0065 void SetDepth (Standard_Real theDepth) { myDepth = theDepth; }
0066
0067
0068 Standard_Boolean HasPickedPoint() const { return myObjPickedPnt.X() != RealLast(); }
0069
0070
0071
0072 const gp_Pnt& PickedPoint() const { return myObjPickedPnt; }
0073
0074
0075 void SetPickedPoint (const gp_Pnt& theObjPickedPnt) { myObjPickedPnt = theObjPickedPnt; }
0076
0077
0078 Standard_Real DistToGeomCenter() const { return myDistToCenter; }
0079
0080
0081 void SetDistToGeomCenter (Standard_Real theDistToCenter) { myDistToCenter = theDistToCenter; }
0082
0083
0084
0085 const NCollection_Vec3<float>& SurfaceNormal() const { return myNormal; }
0086
0087
0088 void SetSurfaceNormal (const NCollection_Vec3<float>& theNormal) { myNormal = theNormal; }
0089
0090
0091 void SetSurfaceNormal (const gp_Vec& theNormal)
0092 {
0093 myNormal.SetValues ((float )theNormal.X(), (float )theNormal.Y(), (float )theNormal.Z());
0094 }
0095
0096 private:
0097 gp_Pnt myObjPickedPnt;
0098 NCollection_Vec3<float> myNormal;
0099 Standard_Real myDepth;
0100 Standard_Real myDistToCenter;
0101 };
0102
0103 #endif