[vtkusers] How can I contour a delaunay2D?

zhangyu zhangyutin at sina.com
Mon Apr 1 20:54:27 EST 2002


Dear users:
   I used the below code to contour a delaunay2D:
    
   this->points=vtkPoints::New();
    for(int i=0;i<100;i++) 
    {
     this->points->InsertPoint(i,this->math->Random(0,1),this->math->Random(0,1),0.0);
      }
    this->profile=vtkPolyData::New();
    this->profile->SetPoints(points);
        
    this->del=vtkDelaunay2D::New();
    this->del->SetInput(profile);
    this->del->BoundingTriangulationOn();
    this->del->SetTolerance(0.00001);
    this->del->SetAlpha(0.1);
    this->del->Update();
    this->shrink=vtkShrinkPolyData::New();
    shrink->SetInput(del->GetOutput());
  
    this->contours=vtkContourFilter::New();
    contours->SetInput(shrink->GetOutput());
    float range[1];
    range[0]=0.0;range[1]=10;
    contours->GenerateValues(5,range);
    
    this->Contourmap=vtkPolyDataMapper::New();
    Contourmap->SetInput(contours->GetOutput());
    Contourmap->SetScalarRange(0.0,1.2);
     this->dgx=vtkActor::New();
     dgx->SetMapper(Contourmap);

  But the vtkContourfilter reported:"no data to contour". How can I use the vtkCountourFilter to do it?
  Thanks any help!
 
zhangyu 


More information about the vtkusers mailing list