[vtkusers] problem with constrained Delaunay2D triangulation

Alexander Smondyrev smondyrev at yahoo.com
Fri Aug 9 11:24:45 EDT 2002


   Hi, 

I am experiencing some problems triangulating a set of
points using Delaunay2D triangulation. The surface is
a northern hemisphere cut by an arbitrary plane. The
points that are triangulated are the union of points
on a sphere (generated using something like Glyph) and
 a set of boundary points (from the intersection of a
sphere and a given plane). I am using Delaunay2D to
triangulate this set of points using the following
code: 

  // Read points from file
  vtkPoints *points = vtkPoints::New();
  fscanf( inhandle, "%d \n", &max );
  xyz = ( double * )malloc( 3*max*sizeof( double ) );
  for( i=0; i<max; i++ ){
    fscanf( inhandle, "%f %f %f \n", &x,&y,&z );
    xyz[3*i] = x;
    xyz[3*i+1] = y;
    xyz[3*i+2] = z;
  }
  for( i=0; i<max; i++ ){
    points->InsertPoint( i, &xyz[3*i] );
  }

  // Specify constraints 
  npts=5;   // Varying this changes the surface
appearance
  vtkCellArray *line = vtkCellArray::New();
    for( i=0; i<npts-1; i++ ){
      line->InsertNextCell(2);
      line->InsertCellPoint( pts[i] );
      line->InsertCellPoint( pts[i+1] );
    }

  vtkPolyData *profile = vtkPolyData::New();
    profile->SetPoints( points );
    profile->SetLines( line );

  vtkDelaunay2D *del = vtkDelaunay2D::New();
    del->SetInput( profile );
    del->SetSource( profile );
    del->SetTolerance( 0.0 );
    del->SetAlpha( 0.0 );
    del->BoundingTriangulationOff();
    del->Update();

What I find wierd is that the surface appeareance
changes depending on how many edges along the cut I
specify as constraints. This problem appeared once for
a particular case where the cutting plane slices a
small part of hemisphere making a small angle with the
equatorial plane. Depending on the number of specified
edges I was getting either a correct surface or pieces
of surface close to the polar cap.I also tried to
change the scheme for generation surface points, but
it did not change things. 

I am in a dire need for some advise. Does my code look
Ok for this operation? Is it possible that I am
encountering some vtkDelaunay bug? So far, I noticed
this kind of problem only once among few dozen cases
that I looked at. I would be glad to provide full code
and data set which is resulting in this behavior. 

Any comments/advises would be greately appreciated. 

  - Alex Smondyrev.


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com



More information about the vtkusers mailing list