Re: DistancetoPrimitive and coordinate system

Valery Fine (fine@bnl.gov)
Fri, 24 Jul 1998 10:20:14 -0500


On 24 Jul 98 at 11:51, Yves Schutz wrote:

> Date: Fri, 24 Jul 1998 11:51:59 +0200
> From: Yves Schutz <schutz@in2p3.fr>
> To: roottalk <roottalk@hpsalo.cern.ch>
> Subject: DistancetoPrimitive and coordinate system

> Hi,
>
> I am afraid that I do not understand how DistancetoPrimitive works
> or may be I have a problem with the coordinate system. Can somebody
> give me some hints.
>
> I have done a display similar to ATLFast. The DistancetoPrimitive
> for any object in my TView is erroneous: dist is always zero at or
> close to the center of the picture ... Do I need to do something
> special with the coordinate system?
>
The method DistancetoPrimite is defined as follows:

" . . .
Int_t TObject::DistancetoPrimitive(Int_t px, Int_t py)

where px, py are the mouse coordinates in pixels.


Computes distance from point (px,py) to the object.
This member function must be implemented for each graphics primitive.
This default function returns a big number (999999).

. . . "

To understand what is going on I would advice to turn on the
TCanvas status bar. In this case the status bar will reflect each
mouse motion and will show the object with the min
DistansetoPrimitive value at the current mouse position.

Hope this may help.

Valery

=================================================================
Dr. Valeri Faine (Fine)
------------------- Phone: +1 516 344 7806
Brookhaven National Laboratory FAX : +1 516 344 4206
Bldg. 510A /STAR mailto:fine@bnl.gov
Upton, New York, 11973-5000 http://nicewww.cern.ch/~fine
USA

Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su