hello Christopher,

thank you for your email and for re-qualifying my question, indeed my
use of the term "origin" was wrong. What I wanted to do was to have
the y positive up as it was by in FC1.

I used the tip that you provided, but applied the transform matrix to
the root node of the canvas.

floatcanvas2.NavCanvas.__init__(self, parent) ### in the context of
subclassing NavCanvas
matrix = np.eye(3,3)
matrix[1,1] =-1
y_up_transform = floatcanvas2.math.transform.LinearTransform2D(matrix = matrix)
self.root.transform = y_up_transform

I'm not sure it is the same as applying it to the canvas as you
indicate at the end of your email, but I think every child of the root
node will inherit this transform.

Thank you for your help,
Pierre

On Tue, Sep 16, 2008 at 6:48 AM, Christopher Barker
<[EMAIL PROTECTED]> wrote:
> Pierre Schmidt wrote:
>> the 0,0 of a floatcanvas2 plane is on the top left of the screen, I
>> would like to move it on the bottom left of the screen, I cannot do
>> this by rotating the camera, I can inverse all my coordinates but I
>> was wondering if there is an option to initialize the canvas with a
>> different orign.
>
> I'm a bit confused. I don't think the origin is anywhere in particular.
> That's one of the points of FloatCanvas (both one and two) you can point
> the camera anywhere you want.
>
> However, from "rotating the camera, I can inverse all my coordinates" I
> think you mean you want y to be positive up, rather than down. That was
> actually the default with FC1.
>
> Anyway, think the way to change it is to provide a transform that flips
> the coords. I'd have thought that Matthias would have provided one out
> of the box, but I can't find it.
>
> However, if you look at floatcanvas.math.transform.py, you'll see class
> LinearTransform2D, into which you can pass an affine transform matrix.
> It defaults to the identity matrix. I think what you want is:
>
> import numpy as np
>
> matrix = np.eye()
> matrix[1,1] =-1
>
> (this will give you a matrix that looks like:
>  1  0  0
>  0 -1  0
>  0  0  1
>
> Which I think will flip the y-axis.
>
> y_up_transform = LinearTransform2D(matrix = matrix)
>
>
> then pass that transform in when you create the canvas:
>
> canvas = fc.NavCanvas( frame,
>                        backgroundColor = 'white',
>                        transform = y_up_transform )
>
> Though I'm only guessing at that part -- I'm not sure how to apply the
> transform to the canvas.
>
> Mattias, have I got this right? I took a loook at some of the tests, but
> I dind't see an exam[ple -- in mercator_test, there is a transform but
> it looks like you are transforming the lines of the map rather than
> applying it to the canvas.
>
> For drawing maps, you'd really want the transfrom applied to the
> canvawes, so from there on out you could just put objects on the map
> without worrying about the projection. Also, youcould then change the
> projection of hte canvas, and everything would just work.
>
> -Chris
>
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> NOAA/OR&R/HAZMAT         (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
> _______________________________________________
> FloatCanvas mailing list
> [email protected]
> http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
>
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to