[Gambas-user] Coordinate system in Gambas Graphics

Jesus Guardon jguardon at ...2035...
Mon Dec 15 21:41:21 CET 2008


Hi Doriano and list

First of all, many thanks for your input. 

Yes, you are right about geographic coordinates; in real world the
intersection between Ecuatorial line and Greenwich meridian is the
coordinate 0;0.  Meridians above increase up to 90 degrees to North and
below to -90 South. By the way, parallels increase up to 180 deg to East and
-180 to West from Greenwich (parallel 0). So the upper left corner (in case
of a whole World map) should be -180;90 and the lower right corner 180;-90.
Based on this, the result rectangle will be 360 units wide * 180 units tall. 

But still is unclear if I can use negative values mapped to a rectangle, as
you appointed in your previous post. The idea is to have a procedure that
can do e.g.  drawCoordinate(-3, 40), and draws a point (or whatever I want)
on the correct place.

Let me play for a while with your program, write some garbage on my notebook
and I will post here my results. Again, thank you for your interest.

Jesus Guardon

Gambas 2.9 


Doriano Blengino wrote:
> 
> I've set up a simple project to show how the transformation matrix works.
> It draws a line from (0;0) to an arbitrary point you specify in LX: and
> LY:.
> You can play with Draw.XXX fields to see they effect.
> What I discovered is that (gambas vesion 2.0.0):
> 
> 1) For me, negative scalings do not work; this is a *serious* limitation.
> 2) Offsets are multiplied by scaling, ie they are expressed in "real 
> world" coordinates.
> 3) Perhaps I am missing something, but it seems to me that you can not 
> read what is the current transformation matrix; the program should keep 
> track of this.
> 
> 
> Now, I don't know what "72N" and "-25W" mean (I think north and west, 
> but that is all), anyway, supposing that they are arbitrary measurement 
> units, then your map is 44+25 units wide, and 72+18 units tall, ie 69 x
> 90.
> You want map this to a 800 x 600. If you don't care about aspect ratio, 
> then do Draw.scale(800 / 69, 600 / 90).
> If you want to mantain aspect ratio (it should be), you assign the same 
> value to scalex and scaley, the smaller of the two: 800/69=11.59, 
> 600/90=6.66, so do Draw.scale(6.66, 6.66).
> As your upper left corner is -25W and 72N, you must do 
> Draw.translate(25, -72).
> At this point, plotting a (25; 72) should go to (0; 0) in the drawing
> area.
>  From here ahead, I think there is a problem with the computer graphics 
> having Y axis pointing to the bottom, so may be your map will be flipped 
> up side down. Every Y coordinate should be transformed by newy = 
> MapHeight-y, so a different draw.translate() must be issued.
> 
> Anyway, it seems to me that the combination of Scale() and Translate() 
> does the following:
> 
>   coordinate_to_plot = (programmed_coordinate + translate_value) * 
> scale_value
> 
> Hope this is enough - I well could have done lot of errors, but the test 
> project can let you experiment.
> 
> Regards,
> Doriano
> 
> 
> 
>  
> ------------------------------------------------------------------------------
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
> Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
> 

-- 
View this message in context: http://www.nabble.com/Coordinate-system-in-Gambas-Graphics-tp20818380p21021618.html
Sent from the gambas-user mailing list archive at Nabble.com.





More information about the User mailing list