<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 &lt;david.gobbi@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Maarten Beek &lt;beekmaarten@yahoo.com&gt; <br><b><span style="font-weight: bold;">Cc:</span></b> "vtkusers@vtk.org" &lt;vtkusers@vtk.org&gt; <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.&nbsp; 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.&nbsp; 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 &lt;<a ymailto="mailto:beekmaarten@yahoo.com"
 href="mailto:beekmaarten@yahoo.com">beekmaarten@yahoo.com</a>&gt; wrote:<br>&gt; Hi all,<br>&gt;<br>&gt; See code below.<br>&gt; What I am trying to do is to connect a piece of cone to a cylinder. To do<br>&gt; this I cut the top of the cone using an implicit cylinder with the same<br>&gt; radius as real cylinder.<br>&gt; However, the radius of the cut cone top is not equal to the radius of the<br>&gt; real cylinder.<br>&gt; What am I doing wrong?<br>&gt;<br>&gt; Does this have to do with how the clip values in the points are<br>&gt; interpolated? And should I refine the triangulation of the cone to get a<br>&gt; better result?<br>&gt;<br>&gt; Thanks - Maarten<br>&gt;<br>&gt; vtkSmartPointer&lt;vtkConeSource&gt; startcone = vtkConeSource::New();<br>&gt; &nbsp; startcone-&gt;SetResolution( 30 );<br>&gt; &nbsp; startcone-&gt;SetHeight( this-&gt;EntryLength );<br>&gt; &nbsp; startcone-&gt;SetRadius( this-&gt;EntryRadius );<br>&gt; &nbsp;
 startcone-&gt;SetCenter( 0.0, -0.5*this-&gt;Length + 0.5*this-&gt;EntryLength, 0.0<br>&gt; );<br>&gt; &nbsp; startcone-&gt;SetDirection( 0.0, 1.0, 0.0 );<br>&gt; &nbsp; startcone-&gt;CappingOff();<br>&gt;<br>&gt; &nbsp; vtkSmartPointer&lt;vtkCylinderSource&gt; cylinder = vtkCylinderSource::New();<br>&gt; &nbsp; cylinder-&gt;SetResolution( 30 );<br>&gt; &nbsp; cylinder-&gt;SetRadius( this-&gt;CylinderRadius );<br>&gt; &nbsp; cylinder-&gt;SetHeight( this-&gt;Length );<br>&gt; &nbsp; cylinder-&gt;SetCenter( 0.0, 0.0, 0.0 );<br>&gt; &nbsp; cylinder-&gt;CappingOff();<br>&gt;<br>&gt; &nbsp; vtkSmartPointer&lt;vtkCylinder&gt; cyl = vtkCylinder::New();<br>&gt; &nbsp; cyl-&gt;SetRadius( this-&gt;CylinderRadius );<br>&gt; &nbsp; cyl-&gt;SetCenter( 0.0, 0.5*this-&gt;Length, 0.0 );<br>&gt;<br>&gt; &nbsp; vtkSmartPointer&lt;vtkClipPolyData&gt; clipper1 = vtkClipPolyData::New();<br>&gt; &nbsp; clipper1-&gt;SetClipFunction( cyl );<br>&gt; &nbsp;
 clipper1-&gt;SetInputConnection( startcone-&gt;GetOutputPort() );<br>&gt;<br>&gt; &nbsp; vtkSmartPointer&lt;vtkAppendPolyData&gt; append = vtkAppendPolyData::New();<br>&gt; &nbsp; append-&gt;AddInput( clipper1-&gt;GetOutput() );<br>&gt; &nbsp; append-&gt;AddInput( cylinder-&gt;GetOutput() );<br><br><br> </div> </div>  </div></body></html>