[vtkusers] what's the difference between actor 's position and sphere 's center ?

fearhope fearhope at gmail.com
Mon Jun 4 12:52:52 EDT 2012


Hi Jochen and David !

thanks for your kind reply. 

I have recently found that sphere uses actor's origin as a coordinates frame
according to many experimentatons. i.e., it moves relatively to the actor's
origin. actor->SetPotion() means to move actor's origin itself. so, they
should not be changed at the same time. and because the sphere source is
changed to polygon data (vertex and edges set), we cannot have original
vtkSphereSource object from the actor reversely.
Is this correct ?

- actor's coordinates frame
http://vtk.1045678.n5.nabble.com/file/n5713569/actor_frame.png  

if so.. there must be three options to update sphere's location.
*1. regenerate new sphere source and mapper, and allocate the new mapper to
the actor at time t-1.
2. when make sphere initially, don't change initial center of sphere.
instead move the actor using SetPosition(). then, when the sphere needs to
move, use SetPosition function of the actor. 
==> in this case, radius cannot be updated. 
3. when the sphere needs to move, transform the polygon data itself using
vtkTransformPolyDataFilter.*

Is this also correct ? (sorry for bothering you. I'm trying to write as
detail as possible for other people)

I have tested 1,2 options. however the problem is speed. while option 1's
speed is around 0.35 ms, option 2 took around 0.002 ms, almost 10 times
faster. so, option 2 is better. however, when consider initial intent of vtk
design, option 2 seems not to be a good approach.

so, it seems that option 3 is best solution if it is fast enough (I guess it
must be similar to the option 2). 
therefore, I would like to test option 3 now. 

*however, to transform polygon data directly, the parameter for
SetInputConnection is required (I referred to the source code in the
presentation file recommended by David). 
Now, how can I get the parameter from actor reversely like
actor->GetMapper()->GetInput()->???*

=======================
vtkSmartPointer<vtkTransform> transformation=
vtkSmartPointer<vtkTransform>::New();
transformation >Translate(double x, double y, double z);
transformation ->RotateX(double angle);
transformation ->Scale(double x, double y, double z);

vtkSmartPointer<vtkTransformPolyDataFilter> transformFilter =
vtkSmartPointer<vtkTransformPolyDataFilter>::New();
transformFilter->SetInputConnection(sphereSource->GetOutputPort()); 
transformFilter->SetTransform(transformation);
transformFilter->Update();     
=======================

I think this would be last question..

thanks in advance..
Kind regards,
Yeonchool

--
View this message in context: http://vtk.1045678.n5.nabble.com/what-s-the-difference-between-actor-s-position-and-sphere-s-center-tp5713553p5713569.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list