These are chat archives for glue-viz/glue-vispy-viewers

5th
May 2016
Thomas Robitaille
@astrofrog
May 05 2016 15:11
@PennyQ - yes, new pyc files should be excluded :)
@PennyQ - are you setting up the transformation to be from canvas to visual?
(rather than visual to canvas)
Penny Qian
@PennyQ
May 05 2016 15:14
@astrofrog yes the main code is as below:
        # get the tr from canvas to the visual
        tr_back = self.volume.get_transform(map_from='canvas', map_to='visual')

        trpos_start = np.insert(self.selection_origin, 2, 1)
        trpos_end = np.insert(self.selection_origin, 2, -1)

        trpos_start = tr_back.map(trpos_start)
        trpos_start = trpos_start[:3] #/ trpos_start[3]

        trpos_end = tr_back.map(trpos_end)
        trpos_end = trpos_end[:3] #/ trpos_end[3]
Thomas Robitaille
@astrofrog
May 05 2016 15:15
and if you use 200,200 the values are more sensible?
can you print out trpos_start and trpos_end before transforming?
Penny Qian
@PennyQ
May 05 2016 15:17
one min I am putting the new rotate_view icon to the PR :)
Thomas Robitaille
@astrofrog
May 05 2016 15:17
np :) I meant just next time you work on it
Penny Qian
@PennyQ
May 05 2016 15:21
hmmm, I didn’t do the homogenous transfer and the result looks not that bad
('before transpos start and end', array([323, 290,   1]), array([323, 290,  -1]))
('after transpos start and end', array([-0.1178813 , -0.01738575, -0.99958254]), array([ 1390.18303156,  1390.2835271 ,  3863.04886131]))
Thomas Robitaille
@astrofrog
May 05 2016 15:21
ok cool :)
Penny Qian
@PennyQ
May 05 2016 15:22
but does’t it make sense, that I didn’t divide the fourth dimension?
Thomas Robitaille
@astrofrog
May 05 2016 15:22
Why not?
Penny Qian
@PennyQ
May 05 2016 15:23
like now we have two points with actually value as [1, 1, 1, 5] and [2, 2, 2, 10], now we only take the [1, 1, 1] and [2, 2, 2] but actually they are the same point...
both stands for [0.2, 0.2, 0.2]
Thomas Robitaille
@astrofrog
May 05 2016 15:24
Ah wait sorry yes, I mean you should do the division
I wonder if the results are really wrong, or if it's still ok - I mean in the end we are going to draw a ray and maybe the ray position is ok?
Penny Qian
@PennyQ
May 05 2016 15:25
then here is the result
('before transpos start and end', array([399, 221,   1]), array([399, 221,  -1]))
('after transpos start and end', array([  10322.6046875 ,   31943.87667411, -262035.41964121]), array([  52.50101689,   52.50315771,  108.5544027 ]))
Thomas Robitaille
@astrofrog
May 05 2016 15:25
Maybe that's ok?
Penny Qian
@PennyQ
May 05 2016 15:25
let me try
Thomas Robitaille
@astrofrog
May 05 2016 15:26
I mean I know one value is a bit crazy but then the +1 and -1 are a bit arbitrary and maybe one point is just far away along the line of sight
I don't know what units -1 and +1 are in
Penny Qian
@PennyQ
May 05 2016 15:30
I was also wondering about +1 and -1 and it looks for ’normalization’, also I didn’t find it from Vispy… they really have the ray_view (the ray direction vector) in the opengl code of VolumeVisual, but there is no way to get it from Python API…
Thomas Robitaille
@astrofrog
May 05 2016 15:37
I have an idea - you could try calling it with many values (e.g. 1000) between -10 and 10 and then see if the resulting coordinates form a ray in 3D, and if it would intersect the data?
just for testing I mean
to make sure we understand the transform
(for the real code we only want to transform two coordinates to get the ray)
Penny Qian
@PennyQ
May 05 2016 15:41
Hmmm, ok, trying~
Penny Qian
@PennyQ
May 05 2016 16:17
@astrofrog I will go for the lunch now, but I found even with that very crazily large result the ray line could still get displayed in the viewer, and the tr_endpoint matches the cursor point very well, but the tr_start looks like from a very far away place which I don’t understand :(
Thomas Robitaille
@astrofrog
May 05 2016 16:51
@PennyQ - but it still works, even though it's far away?
(back soon)
Penny Qian
@PennyQ
May 05 2016 17:18
yes!
I will keep trying now~
Penny Qian
@PennyQ
May 05 2016 18:23
@astrofrog I don’t understand the difference between np.array and np.ndarray, I found even I create an array with np.array([1, 2]) then when I check it’s type it’s np.ndarray not np.array, it’s quite confused...
and then I often faced some problems like the input should be a tuple but I gave it a ndarray, and it’s also tricky to append items into a ndarray….
Penny Qian
@PennyQ
May 05 2016 18:35
@astrofrog I test different values and found only -1 will get a different result (the very large one) from other values
Penny Qian
@PennyQ
May 05 2016 21:21
This message was deleted