[vtkusers] radii of vtkCylinder and vtkCylinderSource are unequal?

Maarten Beek beekmaarten at yahoo.com
Wed Dec 7 14:46:38 EST 2011


Hi all,

See code below.
What I am trying to do is to connect a piece of cone to a cylinder. To do this I cut the top of the cone using an implicit cylinder with the same radius as real cylinder.
However, the radius of the cut cone top is not equal to the radius of the real cylinder.
What am I doing wrong?

Does this have to do with how the clip values in the points are interpolated? And should I refine the triangulation of the cone to get a better result?


Thanks - Maarten


vtkSmartPointer<vtkConeSource> startcone = vtkConeSource::New();
  startcone->SetResolution( 30 );
  startcone->SetHeight( this->EntryLength );
  startcone->SetRadius( this->EntryRadius );
  startcone->SetCenter( 0.0, -0.5*this->Length + 0.5*this->EntryLength, 0.0 );
  startcone->SetDirection( 0.0, 1.0, 0.0 );
  startcone->CappingOff();
  
  vtkSmartPointer<vtkCylinderSource> cylinder = vtkCylinderSource::New();
  cylinder->SetResolution( 30 );
  cylinder->SetRadius( this->CylinderRadius );
  cylinder->SetHeight( this->Length );
  cylinder->SetCenter( 0.0, 0.0, 0.0 );
  cylinder->CappingOff();
  
  vtkSmartPointer<vtkCylinder> cyl = vtkCylinder::New();
  cyl->SetRadius( this->CylinderRadius );
  cyl->SetCenter( 0.0, 0.5*this->Length, 0.0 );
  
  vtkSmartPointer<vtkClipPolyData> clipper1 = vtkClipPolyData::New();
  clipper1->SetClipFunction( cyl );
  clipper1->SetInputConnection( startcone->GetOutputPort() );
  
  vtkSmartPointer<vtkAppendPolyData> append = vtkAppendPolyData::New();
  append->AddInput( clipper1->GetOutput() );
  append->AddInput( cylinder->GetOutput() );
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111207/9597d8e5/attachment.htm>


More information about the vtkusers mailing list