<div>I try to write a c++ using vtkDelaunay3D.all the project links well.but when it runs ,some expect happens. I can 't find the reason.I think I am right.I chang the source,everything works well.I think something is wrong with vtkDelaunay3D.
</div>
<div>
<p>void main()<br> {<br>// vtkCubeSource *cubeData = vtkCubeSource::New();</p>
<p> vtkPoints *points=vtkPoints::New(); <br> vtkPolyData * profile=vtkPolyData::New();<br> srand((unsigned)time(NULL));<br> float x,y,z;<br> x=y=z=0;<br> for(int i=0;i<25;i++)<br> {<br> x=rand()%100/100.0;<br>
y=rand()%100/100.0;<br> z=rand()%100/100.0;<br> points->InsertPoint(i, x, y, z);<br> printf("the %d point: %f,%f,%f\n",i,x,y,z);<br> }<br> <br> profile->SetPoints(points);</p>
<p>// Delaunay3D is used to triangulate the points. The Tolerance is the distance<br>// that nearly coincident points are merged together. (Delaunay does better if<br>// points are well spaced.) The alpha value is the radius of circumcircles,
<br>// circumspheres. Any mesh entity whose circumcircle is smaller than this<br>// value is output.<br>//<br> vtkDelaunay3D *del=vtkDelaunay3D::New();<br> del->SetInput (profile);<br>// del-> BoundingTriangulationOn();
<br> del-> SetTolerance (0.001);<br> del-> SetAlpha (0.2);<br> del-> BoundingTriangulationOff();<br> <br> // Shrink the result to help see it better.<br> vtkShrinkFilter *shrink=vtkShrinkFilter::New();
<br> shrink->SetInput((vtkDataSet *)del->GetOutput());<br> shrink->SetShrinkFactor( 0.9);</p>
<p> vtkPolyDataMapper * map=vtkPolyDataMapper::New();<br> map->SetInput ((vtkPolyData *)(shrink->GetOutput()));</p>
<p> vtkActor * triangulation=vtkActor::New();<br> triangulation->SetMapper(map);<br> triangulation->GetProperty()->SetColor(1, 0, 0);</p>
<p>// Create graphics stuff<br>//<br> vtkRenderer *ren1=vtkRenderer::New();<br> vtkRenderWindow *renWin=vtkRenderWindow::New();<br> renWin->AddRenderer( ren1);<br> vtkRenderWindowInteractor *iren=vtkRenderWindowInteractor::New();
<br> iren-> SetRenderWindow( renWin);</p>
<p>// Add the actors to the renderer, set the background and size<br>//<br>ren1-> AddActor (triangulation);<br>ren1-> SetBackground (1, 1, 1);<br>renWin-> SetSize( 250, 250);</p>
<p>renWin-> Render();<br>iren->Start();<br>map->Delete();<br>triangulation->Delete();<br>del->Delete();<br>profile->Delete();<br>points->Delete();</p>
<p> }</p>
<p>thanks a lot!</p></div>