[vtkusers] Inheritance question

Sylvain Jaume sylvain.jaume at kitware.com
Tue Nov 8 15:14:54 EST 2005


Hi Matt,

Instead of creating a class that inherits from so many classes, why 
don't you use Paraview (http://www.paraview.org) and interactively 
change the rendering parameters?

Cheers,
Sylvain

Matt Valerio wrote:

>Hello VTK users,
>
>I'm new to VTK and am trying to write a visualization app for some data I
>have.
>
>I want to create an object (like a cone) that I can modify its height,
>radium, color, opacity, ambient light, position, and direction all at once.
>
>For example, I have the following code that creates 1 object:
>----------------------------
>vtkConeSource *m_pCone;
>vtkPolyDataMapper *m_pConeMapper;
>vtkActor *m_pConeActor;
>vtkProperty *m_pConeProperty;
>
>m_pCone = vtkConeSource::New();
>m_pCone->SetHeight( 3 );
>m_pCone->SetRadius( 1 );
>m_pCone->SetResolution( 50 );
>
>m_pConeProperty = vtkProperty::New();
>m_pConeProperty->SetColor( 0.1, 0.6, 0.3);
>m_pConeProperty->SetOpacity( 1.0 );
>m_pConeProperty->SetAmbient( 0.8 );
>	
>m_pConeMapper = vtkPolyDataMapper::New();
>m_pConeMapper->SetInput( m_pCone->GetOutput() );
>m_pConeActor = vtkActor::New();
>m_pConeActor->SetMapper( m_pConeMapper );
>m_pConeActor->SetProperty( m_pConeProperty );
>m_pConeActor->SetPosition( 1.0, 1.0, 1.0 );
>-----------------------------
>Then I can add m_pConeActor to the renderer.
>
>Can I create my own class that inherits from a VTK class that will let me do
>something like
>
>MyCone* a = MyCone::New();
>a->SetAttributes( 3, 1, 50, 0.1, 0.6, 0.3, 1.0, 0.8, 1.0, 1.0, 1.0 );
>
>and set all of the values at once?
>
>What class could I inherit from to do this?
>
>Are there any examples to start from?
>
>Any help would be greatly appreciated!
>
>Thanks,
>Matt
>
>
>
>_______________________________________________
>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