[vtkusers] Radii of vtkCylinder and vtkCylinderSource are different?

Maarten Beek beekmaarten at yahoo.com
Thu Sep 1 15:26:07 EDT 2011


I've done some more testing; seems that when I set the radius of the vtkCylinder equal to the radius of the cones, both cones are totally clipped away (setting InsideOutOn keeps both cones in the scene). Does this mean there is something wrong with (my use of) vtkCylinderSource?



________________________________
From: Maarten Beek <beekmaarten at yahoo.com>
To: "vtkusers at vtk.org" <vtkusers at vtk.org>
Sent: Thursday, September 1, 2011 12:49:07 PM
Subject: [vtkusers] Radii of vtkCylinder and vtkCylinderSource are different?


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









_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110901/88b1807d/attachment.htm>


More information about the vtkusers mailing list