[vtkusers] Radii of vtkCylinder and vtkCylinderSource are different?

Maarten Beek beekmaarten at yahoo.com
Thu Sep 1 12:49:07 EDT 2011


Hi all,

I am trying to generate a triangulated surface from cones and cylinders. Where a cone meets a cylinder I want to clip both surface with each other so they nicely 'touch' each other without .
However the radius of vtkCylinder doesn't seem to be the same as the radius of vtkCylinderSource.

The code looks like the following:

vtkSmartPointer<vtkConeSource> cone = vtkConeSource::New();
cone->SetResolution(30);
cone->SetHeight( coneheight );
cone->SetRadius( coneradius );
cone->SetCenter( 0.0, 0.5*coneheight, 0.0 ); // so the bottom of the cone of in the x-z plane
cone->SetDirection( 0.0, 1.0, 0.0 ); // so the cone axis is parallel to y-axis, like with the cylinder
cone->CappingOff();


vtkSmartPointer<vtkCylinderSource> cylinder = vtkCylinderSource::New();
cylinder->SetResolution(30);
cylinder->SetRadius( cylradius ); // cylradius < coneradius
cylinder->SetHeight( cyllength );
cylinder->SetCenter( 0.0, 0.5*cyllength, 0.0 );
cylinder->CappingOff();

vtkSmartPointer<vtkCylinder> cyl = vtkCylinder::New();
cyl->SetRadius( cylradius ); // same value as for vtkCylinderSource
cyl->SetCenter( 0.0, 0.5*cyllength, 0.0 );

vtkSmartPointer<vtkClipPolyData> clipper = vtkClipPolyData::New();
clipper->SetClipFunction( cyl );
clipper->SetInputConnection( cone->GetOutputPort() );

vtkSmartPointer<vtkAppendPolyData> append = vtkAppendPolyData::New();
append->AddInput( cylinder->GetOutput() );
append->AddInput( clipper->GetOutput() );

vtkSmartPointer<vtkPolyDataMapper> mapper = vtkPolyDataMapper::new();
mapper->SetInput( append->GetOutput() );

vtkSmartPointer<vtkActor> actor = vtkActor::New();
actor->SetMapper( mapper );

actor gets the added to a renderer...

The radius of the hole in the tip of the cone appears to be smaller than the radius of the cylinder.
What would be the reason for this?


Thanks - Maarten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110901/ec34e38d/attachment.htm>


More information about the vtkusers mailing list