[vtkusers] [VTKUsers] Problem with clipping a volume (a cone in this case)
Dominik Szczerba
dominik at itis.ethz.ch
Thu Jul 23 03:22:00 EDT 2009
It pretty much sounds to me like you need to include vtkPlanes.h...
-- Dominik
On Thu, 2009-07-23 at 09:11 +0200, Zampini Samuele wrote:
> 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.
> _______________________________________________
> 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
>
More information about the vtkusers
mailing list