[vtkusers] AddActor - Help

Nasos Iliopoulos nasos_i at hotmail.com
Wed Jun 24 09:49:15 EDT 2009


Claude,
You have to think the actor as a real-life actor. The actor has not
written the script of a play, he (or she) is just the one that presents
it on the scene. The script (or data) is founded in the source object and
is been manipulated through filters, then inputed to a mapper (that
translates the data into graphical backend instructions - i.e. OpenGL) 
and then guided through the actor (that can have properties like where
to position itself, what it's scale will be, what color the objects it
acts upon should be, etc.).



Also the pipeline approach is not as the procedural approach. When you
modify an object in the pipeline, all the rest will be updated to
relfect those changes. Take for example:



(1)vtkConeSource

    |

    v

(2)vtkPolyData

    |

    v

(3)vtkActor


    |


    v

(4)vtkRenderer->Window

    |



    v


(5)vtkRenderWindow

    |

    v

(6)vtkRenderWindowInteractor



if you change vtkPolyData (2), everything down the pipeline (3,4,5,6)
will be changed to relfect those changes. Similarly if you change only
the vtkActor (3), everything down the pipeline (4,5,6) will be changed.

>how can i create such pointers:
Look at the example at the end of this message. If you post your code I can help you even further.

> will it only show me the object with the new
> properties but not creating a new windo in the memory and if you said that
> the old properties are lost

The old object will not be "lost", some data of it (i.e. the source) will still be there. So if you want to plot two incarnations of the same object, you will need two different actors with the same input. Look at the cone example to see how it is done:
http://public.kitware.com/cgi-bin/cvsweb.cgi/~checkout~/VTK/Examples/Tutorial/Step4/Cxx/Cone4.cxx
(on lines 59 and 82, two different actors share the same mapper, but the actors have different properties).

Now if you want a new renderer (that will plot the two objects side by side for example as in two windows) you should go for a combination of the above example and the example in:
http://public.kitware.com/cgi-bin/cvsweb.cgi/~checkout~/VTK/Examples/Tutorial/Step3/Cxx/Cone3.cxx
In this case you have one actor but two renderers.

it will be nice to read some documentation on how vtk pipeline works. Here is a nice link that has some nice info:
http://www.imaging.robarts.ca/~dgobbi/vtk/vtkcourse/index.html

I suppose you work on c++, so here is a sort code snippet of how to keep a pointer to your actor:

vtkActor *createDisk()
{
    ....
    .... (1)

    vtkActor *diskActor=vtkActor::New();
    diskActor->SetInput(...); // Something you have created in (1)
    return diskActor; //Dangerous, user must take care of cleaning up.
}

int main()
{
    ...
    vtkActor *disk;
    disk = createDisk();
    disk->SetScale(1.0);

    ren->AddActor(disk);

    ...
    // Later in your program
    disk->SetScale(2.0);
    ren->GetRenderWindow()->Render();

    // When the program exits, or when you no longer need the actor (alternatively you may use a vtkSmartPointer and don't have to worry about the following).
    disk->Delete();
    // Don't forget to delete any other vtk objects you have created!    
    return 0;
} 

Best 
Nasos




> Date: Wed, 24 Jun 2009 06:01:22 -0700
> From: claude.gangolf at gmail.com
> To: vtkusers at vtk.org
> Subject: Re: [vtkusers] AddActor - Help
> 
> 
> I want to change the properties of the actor, but you told me of pointers to
> the actor, how can i create such pointers, and when i call, for example the
> function render() twice, will it only show me the object with the new
> properties but not creating a new windo in the memory and if you said that
> the old properties are lost, would that mean that the there is no old disk
> with the old property saved int the merory but only one disk with the new
> merory?
> 
> Thx for your help you have given to me already
> -- 
> View this message in context: http://www.nabble.com/AddActor---Help-tp24181683p24184332.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers

_________________________________________________________________
Insert movie times and more without leaving Hotmail®.
http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090624/302454c3/attachment.htm>


More information about the vtkusers mailing list