[vtkusers] Pb during extruding a cone.

Patric.Weis at mycrona.de Patric.Weis at mycrona.de
Tue Jun 6 03:54:19 EDT 2000


Hello,

Your code is ok. The problem is, that the cone has no free edges on its
side. See the corresponding warning in the documentation of
vtkLinearExtrusionFilter.
Try to first clip the cone by a plane with the extrusion vector as normal.


Patric Weis
MYCRONA GmbH

- - - Original Message - - -



Hello,


I'm trying to use the vtkLinearExtrusionFilter, and I had a pb when I
used it on a cone : I got 2 separated cones but not one extruded cone.

I've certainly made a mistake in my code, but I don't know where.
(My code is attached with this mail)

Please help me !

Thanks.


--
Guz
------------------------
mailto:despriee at enserb.fr
mailto:despriee at free.fr

#include "vtk.h"



main ()
{


  // create a window
  vtkRenderWindow *renWin;
  renWin = vtkRenderWindow::New();

  //create renderer
  vtkRenderer *ren1;
  ren1 = vtkRenderer::New();
  renWin->AddRenderer(ren1);


  // create interactor
  vtkRenderWindowInteractor *interactor;
  interactor = vtkRenderWindowInteractor::New();
  interactor->SetRenderWindow(renWin);

  // create extruded cone
  vtkConeSource *cone;
  cone = vtkConeSource::New();
  cone->SetRadius(1.0);
  cone->SetHeight(2.0);
  cone->SetResolution(20);

  vtkLinearExtrusionFilter *exCone;
  exCone = vtkLinearExtrusionFilter::New();
  exCone->SetInput(cone->GetOutput());
  exCone->SetExtrusionType(VTK_VECTOR_EXTRUSION);
  exCone->SetVector(1.0, 1.0, 1.0);
  exCone->SetScaleFactor(3.0);

  // map
  vtkPolyDataMapper *exConeMapper;
  exConeMapper = vtkPolyDataMapper::New();
  exConeMapper->SetInput(exCone->GetOutput());

  // actor
  vtkActor *exConeActor;

  exConeActor = vtkActor::New();
  exConeActor->SetMapper(exConeMapper);
  exConeActor->GetProperty()->SetColor(0,0,1);


  ren1->AddActor(exConeActor);
  ren1->SetBackground(0,0,0); //black background
  //create camera/lights automatically


  // Render
  renWin->Render();

  //  Begin mouse interaction
  interactor->Start();


}










More information about the vtkusers mailing list