1 // Copyright: Matra- ()Datavision 1995
2 // File: Select2D_SensitivePoint.cxx
3 // Created: Thu Jan 26 16:37:33 1995
7 #include <Select2D_SensitivePoint.ixx>
8 #include <Bnd_Box2d.hxx>
9 #include <gp_Vec2d.hxx>
10 #include <gp_Lin2d.hxx>
12 //==================================
13 //function : Constructor
15 //==================================
17 Select2D_SensitivePoint::
18 Select2D_SensitivePoint(const Handle(SelectBasics_EntityOwner)& OwnerId,
19 const gp_Pnt2d& Location,
20 const Standard_Real InitSensitivity):
21 Select2D_SensitiveEntity(OwnerId),
23 mysensitivity(InitSensitivity)
27 //==================================
30 //==================================
32 void Select2D_SensitivePoint::
33 Areas (SelectBasics_ListOfBox2d& boxes)
36 abox.Enlarge(mysensitivity);
40 //==================================
43 //==================================
46 Standard_Boolean Select2D_SensitivePoint::
47 Matches (const Standard_Real X,
48 const Standard_Real Y,
49 const Standard_Real aTol,
50 Standard_Real& MinDist)
52 Standard_Real TheTol = HasOwnTolerance()? myOwnTolerance : aTol;
53 MinDist = mylocation.Distance(gp_Pnt2d(X,Y));
54 if(MinDist<=TheTol+mysensitivity) return Standard_True;
55 return Standard_False;
58 Standard_Boolean Select2D_SensitivePoint::
59 Matches (const Standard_Real XMin,
60 const Standard_Real YMin,
61 const Standard_Real XMax,
62 const Standard_Real YMax,
63 const Standard_Real aTol)
64 {//distance point-Line....
66 Standard_Real TheTol = HasOwnTolerance()? myOwnTolerance : aTol;
68 Standard_Real MinDist = gp_Lin2d(gp_Pnt2d(XMin,YMin),
69 gp_Vec2d(gp_Pnt2d(XMin,YMin),
71 ).Distance(mylocation);
73 return (MinDist<=aTol+mysensitivity);