[vtkusers] [VTKUsers] Problem with clipping a volume (a cone in this case)
Zampini Samuele
samuele.zampini at epfl.ch
Thu Jul 23 03:11:13 EDT 2009
Dear friends,
I have a problem when a try to clip a cone.
Here is my code:
================================================
#include <vtkSphereSource.h>
#include <vtkCubeSource.h>
#include <vtkConeSource.h>
#include <vtkPlaneSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkCamera.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include "vtkGtkRenderWindowInteractor.hpp"
#include <vtkInteractorStyleFlight.h>
#include <gtk/gtkgl.h>
vtkRenderer *create_scene()
{
vtkConeSource *cone1 = vtkConeSource::New();
//cone1->SetAngle(20);
cone1->SetHeight(1);
cone1->SetRadius(0.5);
cone1->SetResolution(70);
//map to graphics library
vtkPolyDataMapper *cone1_map = vtkPolyDataMapper::New();
cone1_map->SetInput(cone1->GetOutput());
// actor coordinates geometry, properties, transformation
vtkActor *cone1_actor = vtkActor::New();
cone1_actor->SetMapper(cone1_map);
cone1_actor->SetPosition(0,0,0);
cone1_actor->GetProperty()->SetColor(0,0,0);
Create a simple clipping plane
vtkPlane *plane1 = vtkPlane::New();
plane1->SetOrigin(0.5,0.0,0.0);
plane1->SetNormal(0.1,0.0,0.0);
cone1_map->AddClippingPlane(plane1);
vtkRenderer *ren1 = vtkRenderer::New();
ren1->AddActor(cone1_actor);
ren1->AddActor(planeActor);
ren1->SetBackground(1,1,1);
return ren1;
}
====================================================
And this is ther error message I get:
====================================================
creating-sphere-and-cube.cpp:109: error: incomplete type ‘vtkPlane’ used in nested name specifier
creating-sphere-and-cube.cpp:109: warning: unused variable ‘plane1’
make[1]: *** [creating-sphere-and-cube.o] Error 1
make[1]: Leaving directory `/amd/smana1/root/cmcs/zampini/valvestent/code/gui_lib/general/vtk_c'
make: *** [install] Error 2
====================================================
NB: in the complete code (fully commented) the line 109 is the following:
vtkPlane *plane1 = vtkPlane::New();
Any idea on how to fix this?
Or, also, any different way to clip a volume, let's say a cone, genereted automatically from vtk???
Thanks in advance for help,
Samuele.
More information about the vtkusers
mailing list