[vtkusers] Big problems with vtk coordinates and annotations

Monica Gemo gemo at tele.ucl.ac.be
Wed Nov 16 07:37:15 EST 2005


Hello
I am not experienced with the insight of vtk and 
I having big troubles with coordinate conversions.

I need to calculate the display area occupied by 
annotations (see the picture attached), but I get query values when I try.
An Annotation is a vtkVectorText object 
associated to a vtkPolyDataMapper and a vtkFollower actor.
I made a test with two annotations "OSSO 
MANDIBOLARE" and "COLLETTO" and have been placed 
by fixing their position through the actor. To 
calculate the area they occupy in the viewport, I 
first fetched the annotation bounds from the 
actor (now I know these are world coordinates). 
Out of the bounds values (xmin, xmax, ymin, ymax, 
zmin, zmax), I considered two points P1(xmin, 
ymin, zmin) and P2 (xmax, ymax, zmax) that 
represent the annotation. Till here everything 
seems fine as the values correspond to the annotation proportion that I fixed.
I converted these points from world to display 
coordinates to finally get the displayed area of the annotation.
Strange enough the display values do not 
correspond to the displayed situation.

Here are the values I obtained

The view/viewport size is (1182, 877)

"OSSO MANDIBOLARE" positioned in world coord (10.0, 156.0, 0.0)

P1 and P2 world coordinates (ie bounds from vtkFollower)

x1=010.4259             x2=044.0539             dx=33.628
y1=155.821              y2=158.094              dy=02.273
z1=0                    z2=0                    dz=0

Display conversion of P1 and P2
x1=122.473              x2=257.503              dx=135.03
y1=358.38               y2=317.359              dy=-41.021
z1=0.638066             z2=0.662627             dz=0.024561

(the negative value for dy means that dy 
direction is opposite to the y positive direction 
in the screen/display coordinate system)

"COLLETTO" positioned in world coord (160.0, 152.0, 0.0)

P1 and P2 world coordinates (ie bounds from vtkFollower)

x1=160.656              x2=186.323              dx=25.667
y1=151.731              y2=155.141              dy=3.41
z1=0                    z2=0                    dz=0

Display conversion of P1 and P2
x1=699.387              x2=789.777              dx=90.30
y1=166.56               y2=141.292              dy=-25.268
z1=0.697782             z2=0.720205             dz=0.022423

If you look in the attached picture ANNOTATION1, 
you can see that the first annotation height (dy) 
is lower than the second, while for the 
calculated values is the opposite. How can it happen?
How come that the display coordinates are not on a plane as the world ones?
How can I get correct values corresponding to the 
situation I see in my display?

I changed the position of labels while not moving 
the camera, the result is illustrated in the picture ANNOTATION2:
"OSSO MANDIBOLARE" positioned in world coord (20.0, 170.0, -20.0)
"COLLETTO" positioned in world coord (130.0, 120.0, 40.0)

I performed all calculations, the bounds values 
change, but the dx, dy, dz remain unchanged.
The display coordinates show the same problems.

As an hypothesis I thought this was due to 
particular actor (ie vtkFollower that changes the 
orientation of annotations to keep them aligned 
to the camera), if this is it how can I take into 
account the effect of vtkFollower? Should I apply 
a rotation to the P1 and P2 points before converting them to display?

Sorry for the long mail, but I really need you 
help to understand how to calculate occupied display space for annotations.

Thanks a lot,
Monica

  Monica Gemo - Ph.D. Student
  Communication and Remote Sensing Lab. (UCL/TELE)
  Belgium Lab. of Computer-Human Interaction (UCL/BCHI)
  Université catholique de Louvain
  Address : Stevin Building, room A.147
                  Place du Levant, 2
                  B-1348 Louvain-la-Neuve, BELGIUM
  Tel : + 32 10 47.41.05  -  Fax : + 32 10 47.20.89
  E-mail : gemo at tele.ucl.ac.be
  http://www.tele.ucl.ac.be/view-people.php?id=54
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051116/1d0d4b06/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Annotation2.jpg
Type: image/jpeg
Size: 13335 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051116/1d0d4b06/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Annotation1.jpg
Type: image/jpeg
Size: 13335 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051116/1d0d4b06/attachment-0001.jpg>


More information about the vtkusers mailing list