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

Dhaniram Kshirsagar kdhani99 at gmail.com
Sun Nov 6 23:48:36 EST 2005


Hi Sylvain,
 ---->>>>>Do you mean that you get the input triangles at the output?
Yes I made some sequential polys like this...
  int numPts = Points->GetNumberOfPoints();
for( int idx=0; idx< numPts; )
{
int nPoly[3];
nPoly[0] = idx;
nPoly[1] = ++idx;
nPoly[2] = ++idx;
*vtkPolys*->InsertNextCell( 3, nPoly );
}
 *vtkPolys --> input to vtkPolyData which already contains the vtkPoints.*
**
---->>>>>You do not need to set the polys.
 You mean to say I need to input *only
points*(vtkPoints->vtkPolyData->vtkDelaunay2D)?
and i will get the triangles at output? no cellarray for polys?
 If yes please let me know the code snippet for the same which will take
points and will result in polys(triangles).
 Thanks for the reply.
 Thankx

 2005/11/5, Sylvain Jaume <sylvain.jaume at kitware.com>:
>
> 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
> > >
> > >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051107/8d086c1e/attachment.htm>


More information about the vtkusers mailing list