<DIV>hello all,</DIV>
<DIV>I am looking for help to resolve my problem in VTK for delaunay torus. I first use implicit bool operation to create torus and then extract the torus with vtkExtractGeometry, but the result is not as good as I expected since the result's zigzag. The code and results is as follows.</DIV>
<DIV>&nbsp;</DIV>
<DIV><EM>&nbsp;// create a boolean torus<BR>&nbsp;vtkSmartPointer&lt;vtkQuadric&gt; circle1 = vtkQuadric::New();<BR>&nbsp;circle1-&gt;SetCoefficients(1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0);</EM></DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV><EM>&nbsp;vtkSmartPointer&lt;vtkQuadric&gt; circle2 = vtkQuadric::New();<BR>&nbsp;circle2-&gt;SetCoefficients(1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -0.25);</EM></DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV><EM>&nbsp;vtkSmartPointer&lt;vtkImplicitBoolean&gt; subtract = vtkImplicitBoolean::New();<BR>&nbsp;subtract-&gt;SetOperationTypeToDifference();<BR>&nbsp;subtract-&gt;AddFunction(circle1);<BR>&nbsp;subtract-&gt;AddFunction(circle2);</EM></DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV><EM>&nbsp;vtkSmartPointer&lt;vtkSampleFunction&gt; sample = vtkSampleFunction::New();<BR>&nbsp;sample-&gt;SetImplicitFunction(subtract);<BR>&nbsp;sample-&gt;SetSampleDimensions(30, 30, 30);<BR>&nbsp;sample-&gt;ComputeNormalsOff();</EM></DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV><EM>&nbsp;vtkSmartPointer&lt;vtkExtractGeometry&gt; extract = vtkExtractGeometry::New();<BR>&nbsp;extract-&gt;SetInputConnection(sample-&gt;GetOutputPort());<BR>&nbsp;extract-&gt;SetImplicitFunction(subtract);<BR>&nbsp;extract-&gt;ExtractInsideOn();</EM></DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV><EM>&nbsp;vtkSmartPointer&lt;vtkDelaunay2D&gt; del2D = vtkDelaunay2D::New();<BR>&nbsp;del2D-&gt;SetInputConnection(extract-&gt;GetOutputPort());<BR>&nbsp;del2D-&gt;SetAlpha(0.1);</EM></DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV><EM>&nbsp;vtkSmartPointer&lt;vtkDataSetMapper&gt; mapper = vtkDataSetMapper::New();<BR>&nbsp;mapper-&gt;SetInputConnection(del2D-&gt;GetOutputPort());</EM></DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV><EM>&nbsp;vtkSmartPointer&lt;vtkActor&gt; actor = vtkActor::New();<BR>&nbsp;actor-&gt;SetMapper(mapper);<BR>&nbsp;actor-&gt;GetProperty()-&gt;SetColor(1.0, 1.0, 1.0);<BR>&nbsp;<BR>&nbsp;vtkSmartPointer&lt;vtkRenderer&gt; renderer = vtkRenderer::New();<BR>&nbsp;vtkSmartPointer&lt;vtkRenderWindow&gt; renWin = vtkRenderWindow::New();<BR>&nbsp;vtkSmartPointer&lt;vtkRenderWindowInteractor&gt; iren = vtkRenderWindowInteractor::New();<BR>&nbsp;vtkSmartPointer&lt;vtkInteractorStyleTrackballCamera&gt; style = vtkInteractorStyleTrackballCamera::New();</EM></DIV>
<DIV><EM>&nbsp;renderer-&gt;AddActor(actor);<BR>&nbsp;renderer-&gt;SetBackground(0.0, 0.0, 0.0);<BR>&nbsp;renderer-&gt;ResetCamera();</EM></DIV>
<DIV><EM>&nbsp;renWin-&gt;AddRenderer(renderer);<BR>&nbsp;renWin-&gt;SetSize(500, 500);<BR>&nbsp;renWin-&gt;Render();</EM></DIV>
<DIV><EM>&nbsp;iren-&gt;SetInteractorStyle(style);<BR>&nbsp;iren-&gt;SetRenderWindow(renWin);<BR>&nbsp;</EM><EM>iren-&gt;Initialize();<BR>&nbsp;iren-&gt;Start();</EM></DIV>
<DIV><IMG src="cid:7314ddd8$1$12f4dd37c8a$Coremail$blldw@163.com"></DIV>
<DIV>I would like to make the edge smooth so I add a vtkContourFilter before vtkExtractGeometryFilter, and before the vtkExtractGeometryFilter and vtkDelaunay2D is applied on the output of vtkContourFilter, the result looks good.</DIV>
<DIV><IMG src="cid:5ef0caee$2$12f4dd37c8a$Coremail$blldw@163.com"></DIV>
<DIV>the result is achieved by adding a&nbsp;vtkContourFilter without vtkExtractGeometry and vtkDelaunay2D applied:</DIV>
<DIV>// The code here is the same as above</DIV>
<DIV><EM>vtkSmartPointer&lt;vtkSampleFunction&gt; sample = vtkSampleFunction::New();<BR>&nbsp;sample-&gt;SetImplicitFunction(subtract);<BR>&nbsp;sample-&gt;SetSampleDimensions(30, 30, 30);<BR>&nbsp;sample-&gt;ComputeNormalsOff();</EM></DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV><STRONG>vtkSmartPointer&lt;vtkContourFilter&gt; contour = vtkContourFilter::New();<BR>&nbsp;contour-&gt;SetInputConnection(sample-&gt;GetOutputPort());<BR>&nbsp;contour-&gt;SetValue(0, 0.0);</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV><EM>vtkSmartPointer&lt;vtkDataSetMapper&gt; mapper = vtkDataSetMapper::New();<BR>&nbsp;mapper-&gt;SetInputConnection(contour-&gt;GetOutputPort());</EM></DIV>
<DIV><EM>// the following code is the same as above</EM></DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV>NOW I add vtkExtractGeometry and vtkDelaunay2D after vtkContourFilter:</DIV>
<DIV>&nbsp;</DIV>
<DIV><EM>// contour filter has been added</EM></DIV>
<DIV><EM>vtkSmartPointer&lt;vtkExtractGeometry&gt; extract = vtkExtractGeometry::New();<BR>&nbsp;extract-&gt;SetInputConnection(contour-&gt;GetOutputPort());<BR>&nbsp;extract-&gt;SetImplicitFunction(subtract);<BR>&nbsp;extract-&gt;ExtractInsideOn();</EM></DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV><EM>&nbsp;vtkSmartPointer&lt;vtkDelaunay2D&gt; del2D = vtkDelaunay2D::New();<BR>&nbsp;del2D-&gt;SetInputConnection(extract-&gt;GetOutputPort());<BR>&nbsp;del2D-&gt;SetAlpha(0.1);</EM></DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV><EM>vtkSmartPointer&lt;vtkDataSetMapper&gt; mapper = vtkDataSetMapper::New();<BR>&nbsp;mapper-&gt;SetInputConnection(del2D-&gt;GetOutputPort());</EM></DIV>
<DIV><EM>// The following code doesn't change</EM></DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>What I got is:</DIV>
<DIV><IMG src="cid:129afff4$3$12f4dd37c8a$Coremail$blldw@163.com"></DIV>
<DIV>What should I do in order to get delaunayed smooth torus, OR anyone could give me other methods to get the torus inside of which is delaunayed?</DIV>
<DIV>&nbsp;</DIV><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>