[vtkusers] vtkDelauany2D triangulation--But where are the triangles????

Sylvain Jaume sylvain.jaume at kitware.com
Sat Nov 5 08:19:10 EST 2005


Hi Dhaniram Kshirsagar,

Do you mean that you get the input triangles at the output?
You do not need to set the polys.

Cheers,
Sylvain

Dhaniram Kshirsagar wrote:

> Hi Sylvain,
>  
> After setting the vtkcellarray(for polys) in vtkpolydata (which is 
> input to the delaunay2d), Now I am able to get the triangles.
>  
> Thankx
>
>  
> 2005/11/4, Sylvain Jaume <sylvain.jaume at kitware.com 
> <mailto:sylvain.jaume at kitware.com>>:
>
>     Hi Dhaniram Kshirsagar,
>
>     You don't need to use delaunay->SetSource().
>     Use it only if you want constrained Delaunay.
>
>     Cheers,
>     Sylvain
>
>     Dhaniram Kshirsagar wrote:
>
>     > Hi,
>     >
>     > I searched the entire mail archive for answer to my problem, but
>     found
>     > only problems no solutions to them.
>     >
>     > My problem is, I have input points in the form of x, y and z (large
>     > numbers(double type)) and i want the output as the set of triangles,
>     > however i am getting only the
>     > vertics.
>     >
>     > Here is the code snippet that i am using to get the output as set of
>     > triangles.
>     >
>     > vtkDelaunay2D* pDelny = vtkDelaunay2D::New( );
>     > vtkPolyData* pPointSet = vtkPolyData::New( );
>     > vtkPoints* pPoints = vtkPoints::New( );
>     >
>     >                 //collects the points i.e. x , y, and z
>     > GetPoints( pPoints );
>     >
>     > pPointSet->SetPoints( pPoints );
>     >
>     > //now generate the vtk file
>     > vtkPolyDataWriter* writer = vtkPolyDataWriter::New();
>     > writer->SetFileName( "c:\\earth.vtk");
>     > writer->SetInput( pPointSet );
>     > writer->Write(); //throws an exception
>     > writer->Update();
>     >            *    /***the generated vtk file contains the only one
>     fixed
>     > value***/
>     >               ///However i am not usig this file
>     > *
>     > pDelny->SetTolerance( 0.001 );
>     > //pDelny->SetBoundingTriangulation(1);
>     > pDelny->SetAlpha( 1 );
>     > //pDelny->BoundingTriangulationOff();
>     > //pDelny->SetOffset( 1000 );
>     >
>     > pDelny->SetInput(pPointSet);
>     > pDelny->SetSource( pPointSet );
>     > pDelny->Update();
>     >
>     >
>     >  vtkPolyData* pVtkData = pDelny->GetOutput( );
>     >  int nsize = pVtkData->GetNumberOfCells(); //returned the same
>     number
>     > as the number of points
>     >  vtkCellArray* cellPol = pVtkData->GetPolys(); //zero returned
>     >  int numpol = cellPol->GetNumberOfCells();
>     >  vtkCellArray* cellVert = pVtkData->GetVerts();
>     >  int numver = cellVert->GetNumberOfCells(); //returned the same
>     number
>     > as the number of points
>     >
>     >  nCells = pVtkData->GetNumberOfPolys();
>     >  nCnt3 = pVtkData->GetNumberOfVerts(); //returned the same number as
>     > the number of points
>     >
>     > But where are the triangles????
>     >
>     > Now through pDelny->GetOutput I am expecting set of triangles in
>     > vtkPolyData object.
>     > Am I right?
>     >
>     > Thanks
>     >
>     >------------------------------------------------------------------------
>     >
>     >_______________________________________________
>     >This is the private VTK discussion list.
>     >Please keep messages on-topic. Check the FAQ at:
>     http://www.vtk.org/Wiki/VTK_FAQ
>     >Follow this link to subscribe/unsubscribe:
>     >http://www.vtk.org/mailman/listinfo/vtkusers
>     >
>     >
>
>



More information about the vtkusers mailing list