[RE][vtkusers] scaling of actors while preserving axes - scale.

Kleistereimer kleistereimer at gmx.de
Fri Sep 15 03:40:12 EDT 2006


hi!


ok,
- i could use a vtkSliderWidget, and
- use the vtkCommand::InteractionEvent to update the x-scaling factor of
the actor using Actor->SetScale ...

but this does not solves my current problem.

i dont have a problem with user-interaction here, i just need some lines
of code which stretches my actor by , say, 800x in the x direction,
while keeping the y and z direction intact. This will make my diagram
wider, but hight and depth remain.

Actor->SetScale(old_x * 800.0, old_y, old_z)

will do exactly this, but unfortunately it changes the numbers from the
coordinate axes too. (which i added to the actor using vtkCubeAxesActor2D.)

the numbers from the x axis dont read 0 .. 1 anymore, but  0 .. 800
after the scaling. this is not what i want.

SetScale seems to transparently scale the actual data, while i just need
to display it scaled. Axes and picking should show the real x position
of the data (range 0 .. 1) not the scaled position (range 0 .. 800).


so my question is: which gearing do i have to use to get visual scaling
in x direction to work WHILE preserving axis-labels?
(and while not affecting other actors which might be displayed nearby)

1)
a combination of SetScale and manually overwriting the range displayed
by the axes (resetting to [0..1])

2)
some other api-function which lets the axes-text frozen

3)
some interactive widged (vtkSliderWidget) (??)



thank you for your time

regards
kl




praveen tayal wrote:
> 
> Try using the widgets and apply callbacks to get the scaling -zoom-in/out
> 
> Praveen
> 
> 
>     ---------[ Received Mail Content ]----------
> 
>     *Subject : *[vtkusers] scaling of actors while preserving axes - scale.
> 
>     *Date : *Tue, 12 Sep 2006 22:47:33 +0000
> 
>     *From : *Kleistereimer <kleistereimer at gmx.de>
> 
>     *To : *vtkusers at vtk.org
> 
> 
>     dear list,
> 
> 
> 
>     i display data and attached an vtkCubeAxesActor2D to show x,y,z axis in
> 
> 
>     data - coordinates. this works fine and looks very good out of the box.
> 
> 
> 
>     now i have data with y ranging from 0 .. 1000 , and x from 0 .. 1. this
> 
> 
>     results in a very narrow visualization, which i want to stretch in x
> 
> 
>     direction while preserving the labels on the x axis. (still from 0 .. 1)
> 
> 
> 
>     i tried using 'Actor->SetScale(x,y,z)' and it worked fine, it scales the
> 
> 
>     actor properly. but the axes adapt and show 'wrong' values now. (say, 0
> 
> 
>     .. 800 for a x-scaling-factor of 800)
> 
> 
> 
>     so how to solve this?
> 
> 
> 
>     naively i can imagine 3 possibilities:
> 
> 
> 
>     1) change coordinate-system (x-spacing)
> 
> 
>     -> not good since other actors would be affected too.
> 
> 
> 
>     2) relabel the axes while scaling
> 
> 
>     -> not good since i would need to keep scaling and axes in sync manualy.
> 
> 
>     besides this the line
> 
> 
>     '(vtkCubeAxesActor2D*)m_scales)->GetXAxisActor2D()->SetRange(0.0, 1.0);'
> 
> 
>     shows no effect in my test.
> 
> 
> 
>     3) put object AND axes into another object, 'freeze' the axes (?) and
> 
> 
>     scale the outer object (?)
> 
> 
> 
> 
>     any idea / vtkClasses i could try?
> 
> 
> 
>     thankyou for your help.
> 
> 
> 
> 
>     regareds
> 
> 
>     kl
> 
> 
>     _______________________________________________
> 
> 
>     This is the private VTK discussion list.
> 
> 
>     Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> 
>     Follow this link to subscribe/unsubscribe:
> 
> 
>     http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 
> 




More information about the vtkusers mailing list