[vtkusers] WG: vtkDelaunay2D from point cloud

段新桥 sancho at whu.edu.cn
Wed Mar 8 03:19:33 EST 2017


Hi Bea,
vtkDelaunay2D works on the presumption that all points lie on 2D plane (Z values are ignored), and then perform constrained Delaunay triangulation. The vertices of the reconstructed 2D mesh are then replaced with true Z values.
So, regards to 2D Delaunay, it might be noted that points may NOT be numerically collineation. However, collineation might be quite usually when points are regularly gridded / sampled. In thus situation, a practicable try might be numeric perturbation. That is, record the points (vtkPoints), generate a slight random displacement for each point, triangulate the perturbed points (vtkDelaunay2D), replace the points with original one.

Good luck.

Oyster

At2017-03-08 15:37:27,段新桥sancho at whu.edu.cnwrote:

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 | 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/2b1cf75c/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: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170308/2b1cf75c/attachment.gif>


More information about the vtkusers mailing list