Re: [ROOT] How to calculate distance between pushed and released points.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Nov 09 2002 - 20:49:59 MET


Hi Harufumi,
Assuming that 
  Int_t px1,py1 are the mouse pixel coordinates of the point
where you press the button and px2,py2 where you release
the button, you can compute the user coordinates with
  Double_t x1 = gPad->AbsPixeltoX(px1);
  Double_t y1 = gPad->AbsPixeltoX(py1);
same for x2,y2

Rene Brun



On Sat, 9 Nov 2002, Harufumi TSUCHIYA wrote:

> 
> Hello ROOTers
> 
> I am now trying to modify exec1.C in $ROOT/tutorials to
> calculate distance two points along x-axis of my histogram.
> The two points are pushed and released by mouse, respectively.
> 
> I succeeded in knowing pushed points and released points
> using return values of gPad->GetEvent()(kButton1Down and kButton1Up).
> 
> But, the distance between two points could not be obtained.
> 
> So, is there the way to get the distance of the two points ?
> 
> Harufumi Tsuchiya
> 
> ROOT v3.03.09
> g++ 2.95.3
> FreeBSD 4.6.2
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:17 MET