World Coordinates are not Cartesian
by Jason Cahill · in Torque Game Builder · 04/15/2006 (8:50 am) · 7 replies
OK, I admit it... I'm not the best when it comes to math... and I'll also admit that I've owner T2D for over a year and I'm just noticing this now: the default coordinates are not Cartesian! When you say:
you end up with a screen from (-50, -37.5) in the top-left to (50, 37.5) in the bottom-right. Is there anyway to make T2B use Cartesian coordinates, so I would get:
(-50, 37.5) in the top-left and (50, -37.5) in the bottom-right?
Thanks!
sceneWindow2D.setCurrentCameraPosition("0 0 100 75");you end up with a screen from (-50, -37.5) in the top-left to (50, 37.5) in the bottom-right. Is there anyway to make T2B use Cartesian coordinates, so I would get:
(-50, 37.5) in the top-left and (50, -37.5) in the bottom-right?
Thanks!
About the author
#2
which will give you a camera space from (0, 0)-(100, 75), which is very "computer friendly." (0, 0) is the top-left.
But, it seems like there should be an equivalent setting for normal "math friendly" coordinates as I mention in my first post.
04/15/2006 (11:05 am)
I understand the motivation to have "computer coordinates" as an option. So for example:sceneWindow2D.setCurrentCameraPosition("50 37.5 100 75");which will give you a camera space from (0, 0)-(100, 75), which is very "computer friendly." (0, 0) is the top-left.
But, it seems like there should be an equivalent setting for normal "math friendly" coordinates as I mention in my first post.
#3
04/15/2006 (11:42 am)
Off the top of my head: sceneWindow2D.setCurrentCameraArea("0 0 100 75");
#4
04/15/2006 (11:52 am)
Sorry, but huh? If you read my first post, your example is not cartesian. The Y-axis is reversed.
#5
Melv: Out of curiousity, why did you choose this solution? Is there something about it in particular? Are you just in favor of "computer friendly" coordinates?
04/15/2006 (1:23 pm)
Looking at the sources, the notion of a "normalized rectangle" looks extremely hardcoded.Melv: Out of curiousity, why did you choose this solution? Is there something about it in particular? Are you just in favor of "computer friendly" coordinates?
#6
04/15/2006 (1:31 pm)
Also, please don't take my comments as judgemental. I'm not saying that TGB sucks because of this choice. I'm simply curious why this decision was made. The impetus beyond the question is: I'm using Lightwave to do level rendering and layout and having to flip all of the Y coords is a bit of a hassle. At first, nothing was working (everything was upside down). Then, when I figured it out, it was workaroundable, but a minor hassle.
#7
This is due for the simple fact that 0,0 is always top left (beside the windows desktop that behaves nonstandard ) extending to width-1,height-1 on the bottom right.
Choosing the coordinates this way in TGB is a good thing as textures follow that 0,0 - width-1,height-1 as well (as their UVs do)
If you would make it like some geometry teachers and Windows Desktop do and choose the 0,0 at bottom left, then you would end with a lot of recalculation for UV, drawing etc to make it look correct again. processortime you could use for better things, I'm sure :)
Beside that: cartesian coordinates are not fixed as well ... those know as well of left-handed and right-handed which invert a coordinate axis if you switch between those systems. So its a point of view what the "positive" and what "negative" axis alignement is.
04/16/2006 (6:19 am)
This coordinates are "godgiven" ... (ok not god but computer graphics).This is due for the simple fact that 0,0 is always top left (beside the windows desktop that behaves nonstandard ) extending to width-1,height-1 on the bottom right.
Choosing the coordinates this way in TGB is a good thing as textures follow that 0,0 - width-1,height-1 as well (as their UVs do)
If you would make it like some geometry teachers and Windows Desktop do and choose the 0,0 at bottom left, then you would end with a lot of recalculation for UV, drawing etc to make it look correct again. processortime you could use for better things, I'm sure :)
Beside that: cartesian coordinates are not fixed as well ... those know as well of left-handed and right-handed which invert a coordinate axis if you switch between those systems. So its a point of view what the "positive" and what "negative" axis alignement is.
Torque 3D Owner Tom Perry