TPad::PixeltoY : wrong result

From: Hajo Molegraaf <hjausenet_at_hotmail.com>
Date: Sun, 09 Apr 2006 15:17:53 +0200


Hi,
I have the impression that TPad::PixeltoY returns a wrong answer. Consider the following:

root [0] TCanvas* c = new TCanvas
root [1] TH2F* axes = new TH2F("","",10,-5,20,10,-1,2.5)
root [2] axes->Draw()
root [3] c->Draw()
root [4] c->XtoPixel(5.0)

(const Int_t)292

root [5] c->PixeltoX(292)
(Double_t)4.98563216049116953e+00 // Correct
root [6] c->YtoPixel(1.0)
(const Int_t)209

root [7] c->PixeltoY(209)
(Double_t)(-3.37473520790611614e+00) // Wrong
root [8] c->PixeltoY(209 - c->GetWh())
(Double_t)1.00026483283924716e+00 // Correct !!

I have the impression that YtoPixel uses a positive y-axis that runs from the top to the bottom, while YtoPixel uses a positive y-axis that runs from the bottom to the top. Or am I doing something wrong?

Hajo.



Krijg direct antwoord op je vragen: MSN Messenger http://www1.imagine-msn.com/Messenger/Default2.aspx Received on Sun Apr 09 2006 - 15:18:00 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET