qt-interest@trolltech.com
[Top] [All Lists]

Re: QT4.3 coordinate oddness

Subject: Re: QT4.3 coordinate oddness
From: John McClurkin
Date: Mon, 05 Mar 2007 08:44:48 -0500
Jeff Lacki wrote:
John McClurkin wrote:

The upper left origin is standard in QNX, Windows, and Linux, probably in Mac OSX as well. OpenGL is the only API that I know of that uses a lower left origin. What I do to plot data "right side up" is
    windowY = windowHeight * (dataY - dataMax) / -dataRange;

Thanks John. After I played with this a while I wondered why not just multiply all the Y values by -1 to 'flip' the image. The only issue I found was that I needed to subtract the height of each object. Maybe others needed the 'flip' to line up within the viewport, but for me, since Im initializing data as I startup the Scene, I dont really care where its at on the Y scale, just as long as it comes up right side up. I replied mostly just find out if Im missing something
that will bite me later.
Well, the data I plot are all positive values. If I just multiply by -1, the data will be shifted out of the view port. Second, I want the data to fit entirely within the view port. Therefore, subtracting dataMax from dataY gives a negative value. Dividing by the negative of the data range flips the data value and scales it to the range. Multiplying by the windowHeight squeezes the data into the window.

Thanks again for all the help,
Jeff
You are welcome


--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>