<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Thanks David,</span></div><div><br><span></span></div><div><span>Good to know it is an approximating issue, and not me.</span></div><div><br><span></span></div><div><span>However, I don't really know where the plane is. Although I could calculate it, but then I could position the vertices and triangulate between them myself (no need for the vtkClipPolyData class...).</span></div><div><br><span></span></div><div><span>I guess improving the clipping would involve vtkGenericCell::Clip().</span></div><div><br><span></span></div><div><span>Also, I made a simple application in which I can change the length of the cone relative to the radius of the cylinder; I don't see the clipping improve when I do this... so I am not yet convinced regarding your rule.</span></div><div><br><span></span></div><div><span>Does VTK have a class
that triangulates the triangles in a vtkPolyData? The cone resolution just makes the triangles narrower or wider (they keep going from bottom to top).</span></div><div><br><span></span></div><div><span>I think that creating my own ConeCylinderSource class is easiest...<br></span></div><div><br><span></span></div><div><span>Maarten</span></div><div><br></div> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> David Gobbi <david.gobbi@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Maarten Beek <beekmaarten@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> "vtkusers@vtk.org" <vtkusers@vtk.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, December 7, 2011 3:26:42 PM<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [vtkusers] radii of vtkCylinder and vtkCylinderSource are unequal?<br> </font> <br>Refining the cone resolution will help, but if you can, you should use<br>a plane to clip the cone, instead of using a cylinder.<br><br>VTK does clipping by evaluating the implicit function at each end of<br>each line segment, and then it does a linear interpolation along the<br>line segment to find the point where it does the clip. This works<br>perfectly when the function is a plane function, but it is only<br>approximate if the function is a curved surface.<br><br>The rule is: the lengths of the polygon edges must be much less then<br>the radius of curvature of the implicit function. A plane has an<br>infinite radius of curvature, so clipping with a plane is always<br>ideal.<br><br> - David<br><br><br>On Wed, Dec 7, 2011 at 12:46 PM, Maarten Beek <<a ymailto="mailto:beekmaarten@yahoo.com"
href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>> wrote:<br>> Hi all,<br>><br>> See code below.<br>> What I am trying to do is to connect a piece of cone to a cylinder. To do<br>> this I cut the top of the cone using an implicit cylinder with the same<br>> radius as real cylinder.<br>> However, the radius of the cut cone top is not equal to the radius of the<br>> real cylinder.<br>> What am I doing wrong?<br>><br>> Does this have to do with how the clip values in the points are<br>> interpolated? And should I refine the triangulation of the cone to get a<br>> better result?<br>><br>> Thanks - Maarten<br>><br>> vtkSmartPointer<vtkConeSource> startcone = vtkConeSource::New();<br>> startcone->SetResolution( 30 );<br>> startcone->SetHeight( this->EntryLength );<br>> startcone->SetRadius( this->EntryRadius );<br>>
startcone->SetCenter( 0.0, -0.5*this->Length + 0.5*this->EntryLength, 0.0<br>> );<br>> startcone->SetDirection( 0.0, 1.0, 0.0 );<br>> startcone->CappingOff();<br>><br>> vtkSmartPointer<vtkCylinderSource> cylinder = vtkCylinderSource::New();<br>> cylinder->SetResolution( 30 );<br>> cylinder->SetRadius( this->CylinderRadius );<br>> cylinder->SetHeight( this->Length );<br>> cylinder->SetCenter( 0.0, 0.0, 0.0 );<br>> cylinder->CappingOff();<br>><br>> vtkSmartPointer<vtkCylinder> cyl = vtkCylinder::New();<br>> cyl->SetRadius( this->CylinderRadius );<br>> cyl->SetCenter( 0.0, 0.5*this->Length, 0.0 );<br>><br>> vtkSmartPointer<vtkClipPolyData> clipper1 = vtkClipPolyData::New();<br>> clipper1->SetClipFunction( cyl );<br>>
clipper1->SetInputConnection( startcone->GetOutputPort() );<br>><br>> vtkSmartPointer<vtkAppendPolyData> append = vtkAppendPolyData::New();<br>> append->AddInput( clipper1->GetOutput() );<br>> append->AddInput( cylinder->GetOutput() );<br><br><br> </div> </div> </div></body></html>