<div>Hi Sylvain,</div>
<div> </div>
<div>That worked for me... thanks :)</div>
<div> </div>
<div>One change is required in following code:</div>
<div>change:</div>
<div><strong>vtkPolyData* outMesh = delaunay2D->GetOutPut( );</strong></div>
<div><strong>delaunay2D</strong>->GetPolys()->InitTraversal();<br><br>while ( d<strong>elaunay2D</strong>->GetPolys()->GetNextCell( npts, pts ) )<br>{<br> cout << "points in the triangle: " << pts[0] << " " << pts[1] << " "
<br><< pts[2] << "\n";<br>}<br> </div>
<div>Instead of delaunay2D ptr here the ptr of polydata which is output from triangulation should be used.</div>
<div> </div>
<div>thanks<br>dhani<br> </div>
<div><span class="gmail_quote">2005/11/7, Sylvain Jaume <<a href="mailto:sylvain.jaume@kitware.com">sylvain.jaume@kitware.com</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi Dhaniram Kshirsagar,<br><br>vtkDelaunay2D takes points at its input, and gives triangles at its ouput.<br>
Read <a href="http://www.vtk.org/doc/nightly/html/classvtkDelaunay2D.html">http://www.vtk.org/doc/nightly/html/classvtkDelaunay2D.html</a><br>More information in the VTK book:<br><a href="http://www.kitware.com/products/vtktextbook.html">
http://www.kitware.com/products/vtktextbook.html</a><br><br>You may find this code snippet useful:<br><br>vtkPoints *newPoints = vtkPoints::New();<br>newPoints->InsertNextPoint( 0, 0, 0 );<br>newPoints->InsertNextPoint( 1, 0, 0 );
<br>// create more points<br><br>vtkPolyData *polyData = vtkPolyData::New();<br>polyData->SetPoints( newPoints );<br>newPoints->Delete();<br><br>vtkDelaunay2D *delaunay2D = vtkDelaunay2D::New();<br>delaunay2D->SetInput( polyData );
<br>polyData->Delete();<br>delaunay2D->Update();<br><br>int npts, *pts;<br><br>delaunay2D->GetPolys()->InitTraversal();<br><br>while ( delaunay2D->GetPolys()->GetNextCell( npts, pts ) )<br>{<br> cout << "points in the triangle: " << pts[0] << " " << pts[1] << " "
<br><< pts[2] << "\n";<br>}<br><br>Cheers,<br>Sylvain<br><br>Dhaniram Kshirsagar wrote:<br><br>> Hi Sylvain,<br>><br>> ---->>>>>Do you mean that you get the input triangles at the output?
<br>> Yes I made some sequential polys like this...<br>><br>> int numPts = Points->GetNumberOfPoints();<br>> for( int idx=0; idx< numPts; )<br>> {<br>> int nPoly[3];<br>> nPoly[0] = idx;<br>
> nPoly[1] = ++idx;<br>> nPoly[2] = ++idx;<br>> *vtkPolys*->InsertNextCell( 3, nPoly );<br>> }<br>><br>> *vtkPolys --> input to vtkPolyData which already contains the vtkPoints.*<br>> **<br>
> ---->>>>>You do not need to set the polys.<br>><br>> You mean to say I need to input *only points*<br>> (vtkPoints->vtkPolyData->vtkDelaunay2D)?<br>> and i will get the triangles at output? no cellarray for polys?
<br>><br>> If yes please let me know the code snippet for the same which will<br>> take points and will result in polys(triangles).<br>><br>> Thanks for the reply.<br>><br>> Thankx<br>><br>><br>
> 2005/11/5, Sylvain Jaume <<a href="mailto:sylvain.jaume@kitware.com">sylvain.jaume@kitware.com</a><br>> <mailto:<a href="mailto:sylvain.jaume@kitware.com">sylvain.jaume@kitware.com</a>>>:<br>><br>> Hi Dhaniram Kshirsagar,
<br>><br>> Do you mean that you get the input triangles at the output?<br>> You do not need to set the polys.<br>><br>> Cheers,<br>> Sylvain<br>><br>> Dhaniram Kshirsagar wrote:
<br>><br>> > Hi Sylvain,<br>> ><br>> > After setting the vtkcellarray(for polys) in vtkpolydata (which is<br>> > input to the delaunay2d), Now I am able to get the triangles.<br>
> ><br>> > Thankx<br>> ><br>> ><br>> > 2005/11/4, Sylvain Jaume <<a href="mailto:sylvain.jaume@kitware.com">sylvain.jaume@kitware.com</a><br>> <mailto:<a href="mailto:sylvain.jaume@kitware.com">
sylvain.jaume@kitware.com</a>><br>> > <mailto:<a href="mailto:sylvain.jaume@kitware.com">sylvain.jaume@kitware.com</a><br>> <mailto:<a href="mailto:sylvain.jaume@kitware.com">sylvain.jaume@kitware.com
</a>>>>:<br>> ><br>> > Hi Dhaniram Kshirsagar,<br>> ><br>> > You don't need to use delaunay->SetSource().<br>> > Use it only if you want constrained Delaunay.
<br>> ><br>> > Cheers,<br>> > Sylvain<br>> ><br>> > Dhaniram Kshirsagar wrote:<br>> ><br>> > > Hi,<br>> > ><br>> > > I searched the entire mail archive for answer to my
<br>> problem, but<br>> > found<br>> > > only problems no solutions to them.<br>> > ><br>> > > My problem is, I have input points in the form of x, y and
<br>> z (large<br>> > > numbers(double type)) and i want the output as the set of<br>> triangles,<br>> > > however i am getting only the<br>> > > vertics.<br>
> > ><br>> > > Here is the code snippet that i am using to get the output<br>> as set of<br>> > > triangles.<br>> > ><br>> > > vtkDelaunay2D* pDelny = vtkDelaunay2D::New( );
<br>> > > vtkPolyData* pPointSet = vtkPolyData::New( );<br>> > > vtkPoints* pPoints = vtkPoints::New( );<br>> > ><br>> > > //collects the points
i.e. x , y, and z<br>> > > GetPoints( pPoints );<br>> > ><br>> > > pPointSet->SetPoints( pPoints );<br>> > ><br>> > > //now generate the vtk file
<br>> > > vtkPolyDataWriter* writer = vtkPolyDataWriter::New();<br>> > > writer->SetFileName( "c:\\earth.vtk");<br>> > > writer->SetInput( pPointSet );<br>
> > > writer->Write(); //throws an exception<br>> > > writer->Update();<br>> > > * /***the generated vtk file contains the<br>> only one<br>> > fixed
<br>> > > value***/<br>> > > ///However i am not usig this file<br>> > > *<br>> > > pDelny->SetTolerance( 0.001 );<br>> > > //pDelny->SetBoundingTriangulation(1);
<br>> > > pDelny->SetAlpha( 1 );<br>> > > //pDelny->BoundingTriangulationOff();<br>> > > //pDelny->SetOffset( 1000 );<br>> > ><br>> > > pDelny->SetInput(pPointSet);
<br>> > > pDelny->SetSource( pPointSet );<br>> > > pDelny->Update();<br>> > ><br>> > ><br>> > > vtkPolyData* pVtkData = pDelny->GetOutput( );
<br>> > > int nsize = pVtkData->GetNumberOfCells(); //returned the<br>> same<br>> > number<br>> > > as the number of points<br>> > > vtkCellArray* cellPol = pVtkData->GetPolys(); //zero returned
<br>> > > int numpol = cellPol->GetNumberOfCells();<br>> > > vtkCellArray* cellVert = pVtkData->GetVerts();<br>> > > int numver = cellVert->GetNumberOfCells(); //returned the
<br>> same<br>> > number<br>> > > as the number of points<br>> > ><br>> > > nCells = pVtkData->GetNumberOfPolys();<br>> > > nCnt3 = pVtkData->GetNumberOfVerts(); //returned the same
<br>> number as<br>> > > the number of points<br>> > ><br>> > > But where are the triangles????<br>> > ><br>> > > Now through pDelny->GetOutput I am expecting set of
<br>> triangles in<br>> > > vtkPolyData object.<br>> > > Am I right?<br>> > ><br>> > > Thanks<br>> > ><br>> ><br>> >------------------------------------------------------------------------
<br>> > ><br>> > >_______________________________________________<br>> > >This is the private VTK discussion list.<br>> > >Please keep messages on-topic. Check the FAQ at:
<br>> > <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>> > >Follow this link to subscribe/unsubscribe:<br>> > ><a href="http://www.vtk.org/mailman/listinfo/vtkusers">
http://www.vtk.org/mailman/listinfo/vtkusers</a><br>> > ><br>> > ><br>> ><br>> ><br>><br>><br></blockquote></div><br>