[vtkusers] WG: vtkDelaunay2D from point cloud
Schober Beatrix [STEMMER IMAGING GmbH]
b.schober at stemmer-imaging.de
Wed Mar 8 02:37:27 EST 2017
Hi all,
I guess, it's not possible to send documents with the e-mail? So I skip the document and hope, you can help me nevertheless. Thank you very much in advance!
Bea
Beatrix Schober
Image Acquisition Development
STEMMER IMAGING | Telefon: +49 89 80902-750
b.schober at stemmer-imaging.de<mailto:b.schober at stemmer-imaging.de> | www.stemmer-imaging.de<http://www.stemmer-imaging.de>
[cid:stemmer-imaging-logo_a2683554-0e33-44e9-800c-5f58a623f38a.gif]<http://www.stemmer-imaging.de/>
STEMMER IMAGING GmbH | Gutenbergstr. 9-13 | 82178 Puchheim, Deutschland
Registergericht München HR B 82026 | Geschäftsführer: Wilhelm Stemmer, Christof Zollitsch
Von: Schober Beatrix [STEMMER IMAGING GmbH]
Gesendet: Dienstag, 7. März 2017 17:53
An: vtkusers at vtk.org
Betreff: vtkDelaunay2D from point cloud
Hi all,
I am reading attached image (gray values as z) as point cloud which works fine only displaying the point cloud with 687.371 points (no Delaunay2D filter). As soon as I use the Delaunay2D filter, I get a stack overflow (from vtkFiltersCore.dll - vtkDelaunay2D::FindTriangle(...)).
On the other hand, when setting tolerance to 0.001, I get a mesh within 90 seconds. Actually I want to consider all points, or is it useful to set the tolerance?
Rendering an xyz file with 359.040 points takes 40 seconds (with tolerance = 0.001) with Delaunay2D filter, also too long in a user application.
Rendering an xyz file with 359.040 points takes 12 seconds (without setting tolerance) with Delaunay2D filter. (I do not understand this behaviour.)
Mainly I guess, I am doing something wrong in reading the point cloud and creating the vtkPolyData?
void addPoint(double x, double y, double z)
{
vtkIdType id = m_vtkPoints->InsertNextPoint(x, y, z);
m_vtkDepths->InsertNextValue(z);
m_vtkCells->InsertNextCell(1);
m_vtkCells->InsertCellPoint(id);
m_vtkCells->Modified();
m_vtkPoints->Modified();
m_vtkDepths->Modified();
}
void createPolyData()
{
m_vtkDepths->SetName("DepthArray");
m_vtkPolyData->SetPoints(m_vtkPoints);
m_vtkPolyData->SetVerts(m_vtkCells);
m_vtkPolyData->GetPointData()->SetScalars(m_vtkDepths);
m_vtkPolyData->GetPointData()->SetActiveScalars("DepthArray");
if (m_vtkPolyData->GetNumberOfPoints() > 0)
{
// Set vertex (cell) normals
vtkSmartPointer<vtkDoubleArray> normalsArray = vtkSmartPointer<vtkDoubleArray>::New();
normalsArray->SetNumberOfComponents(3); //3d normals (ie x,y,z)
normalsArray->SetNumberOfTuples(m_vtkPolyData->GetNumberOfPoints());
//construct the normal vectors
double cN1[3] = { 1.0, 0.0, 0.0 };
double cN2[3] = { 0.0, 1.0, 0.0 };
double cN3[3] = { 0.0, 0.0, 1.0 };
//add the data to the normals array
normalsArray->SetTuple(0, cN1);
normalsArray->SetTuple(1, cN2);
normalsArray->SetTuple(2, cN3);
//add the normals to the cells in the polydata
m_vtkPolyData->GetCellData()->SetNormals(normalsArray);
}
}
I am really stuck as I was searching for descriptions, examples etc. since some days now. I hope you can give me as a newbie the right hint.
Thank you very much in advance!
Bea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170308/0ae3a86e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stemmer-imaging-logo_a2683554-0e33-44e9-800c-5f58a623f38a.gif
Type: image/gif
Size: 2320 bytes
Desc: stemmer-imaging-logo_a2683554-0e33-44e9-800c-5f58a623f38a.gif
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170308/0ae3a86e/attachment.gif>
More information about the vtkusers
mailing list