[vtkusers] Delaunay constrained, help
Lady Caires
ladycaires at gmail.com
Sun Oct 25 13:57:57 EDT 2009
Hi,
I'm working with a 2D Delaunay triangulation, and I need to make 2D Delaunay
triangulation with restrictions. I do not know how I can do that. I wrote a
code, but is picking up the wrong points. I need to do the outline also
correct that the restriction to work perfectly. Does anyone have any idea?
Below is the link of the video ...
www.ldcaires.com/video.avi
The code of the point cloud is that
//vtkStructuredPoints *pPoints = i2sp1->GetOutput();
vtkStructuredPoints *pPoints = (vtkStructuredPoints *)i2sp->GetOutput();
pPoints->Update();
int n = pPoints->GetNumberOfPoints();
vtkDataArray *ptScalars;
ptScalars = (pPoints->GetPointData())->GetScalars();
double rgb[3];
double x[3];
printf("\n n=%d", n);
printf("\n size=%d", ptScalars->GetSize());
vtkMath *math = vtkMath::New();
vtkPoints *points = vtkPoints::New();
vtkCellArray *polys = vtkCellArray::New();
register int i;
// Criação de uma polydata com os pontos da imagem
for (i = 0; i < n; i++) {
pPoints->GetPoint(i, x);
((pPoints->GetPointData())->GetScalars())->GetTuple(i, rgb);
points->InsertPoint(i, x[0], x[1],
(rgb[0]*20+rgb[1]*59+rgb[2]*11)/100); //VERIFICAR ESSA MEDIA PONDERADA
polys->InsertNextCell(1);
polys->InsertCellPoint(i);
}
// Introdução da Polydata
vtkPolyData *profile = vtkPolyData::New();
profile->SetPoints(points);
profile->SetVerts(polys);
// Criação do actor de entrada relativo ao mapa de pontos
vtkPolyDataMapper *mapPoints = vtkPolyDataMapper::New();
mapPoints->SetInput(profile);
vtkActor *actorPoints = vtkActor::New();
actorPoints->SetMapper(mapPoints);
(actorPoints->GetProperty())->SetColor(0, 0, 1);
// Criação de dados de texto
vtkVectorText *text = vtkVectorText::New();
text->SetText("PONTOS");
// Mapeação dos vectores de texto
vtkPolyDataMapper *textMapper = vtkPolyDataMapper::New();
textMapper->SetInput(text->GetOutput());
// Criação do actor de texto
vtkActor *textActor = vtkActor::New();
textActor->SetMapper(textMapper);
(textActor->GetProperty())->SetColor(0, 0, 0);
Thank's.....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091025/975be8a0/attachment.htm>
More information about the vtkusers
mailing list