# create tetrahedral from a set of points using vtkDelaunay3D

**URL:** https://discourse.vtk.org/t/create-tetrahedral-from-a-set-of-points-using-vtkdelaunay3d/938
**Category:** Support
**Created:** [May 9, 2019, 8:54pm UTC](https://discourse.vtk.org/t/create-tetrahedral-from-a-set-of-points-using-vtkdelaunay3d/938 "2019-05-09T20:54:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Ida](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/i/ed655f/32.png) [@Ida](https://discourse.vtk.org/u/Ida)
#### Post date: [May 9, 2019, 8:54pm UTC](https://discourse.vtk.org/t/create-tetrahedral-from-a-set-of-points-using-vtkdelaunay3d/938/1 "2019-05-09T20:54:42Z")

</div>

Hi,

How do I create tetrahedral from a set of points using vtkDelaunay3D? This is what I have come up with so far.

vtkDelaunay3D\* getDelaunayTets; // create instance of vtkDelaunay3D  
vtkPoints\* points;  
points=vtkPoints::New(); // initialise points (online example - not clear from doc)  
points-\>InsertNextPoint(0,0,1); // insert points (online example - not sure if points r added)  
points-\>InsertNextPoint(0,0,0);  
points-\>InsertNextPoint(0,1,0);  
points-\>InsertNextPoint(1,0,0);  
points-\>InsertNextPoint(0.5,0.5,0.5);  
vtkUnstructuredGrid\* Mesh; vtkIdType id; double x[3]; vtkIdList\* holeTetras;  
getDelaunayTets-\>InsertPoint(Mesh, points, id, x, holeTetras);

I get an initialisation error for holeTetras and I am not sure how to initialise holeTetras.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [May 9, 2019, 11:04pm UTC](https://discourse.vtk.org/t/create-tetrahedral-from-a-set-of-points-using-vtkdelaunay3d/938/2 "2019-05-09T23:04:58Z")

</div>

First you need to create a point set, then set it at input to the Delaunay filter, execute the filter, then retrieve the unstructured grid output.

Read the VTK textbook and check out related VTK examples.

---

<div class="post-metadata">

### Author: ![Ida](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/i/ed655f/32.png) [@Ida](https://discourse.vtk.org/u/Ida)
#### Post date: [May 11, 2019, 3:10pm UTC](https://discourse.vtk.org/t/create-tetrahedral-from-a-set-of-points-using-vtkdelaunay3d/938/3 "2019-05-11T15:10:05Z")

</div>

Thank you the suggestions.  
If I understand your steps correctly, I need to create points, pass the points to Delaunay and execute a function within Delaunay that returns the mesh.

I have had a look at the vtkDelaunay3D cxx example which reads in points from a file and uses the SetInputConnection function to pass outputs of a filter as input to another filter. What remains unclear to me is how to pass a vtkPointSet (or vtkPoint, used by me) to vtkDelaunay3D. Could you kindly help with this? My c++ skills are still under development. Thanks.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [May 11, 2019, 8:06pm UTC](https://discourse.vtk.org/t/create-tetrahedral-from-a-set-of-points-using-vtkdelaunay3d/938/4 "2019-05-11T20:06:27Z")

</div>

> [@Ida](#):
>
> What remains unclear to me is how to pass a vtkPointSet (or vtkPoint, used by me) to vtkDelaunay3D

It is shown in hundreds of examples how to set input connection or input data in a filter. There is even an [example specifically for using Delaunay3D filter](https://lorensen.github.io/VTKExamples/site/Cxx/Modelling/Delaunay3D/).

Please spend some time reading the freely available [VTK textbook](https://lorensen.github.io/VTKExamples/site/VTKBook/) and [VTK examples](https://lorensen.github.io/VTKExamples/site/).

---

<div class="post-metadata">

### Author: ![Ida](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/i/ed655f/32.png) [@Ida](https://discourse.vtk.org/u/Ida)
#### Post date: [May 12, 2019, 10:10am UTC](https://discourse.vtk.org/t/create-tetrahedral-from-a-set-of-points-using-vtkdelaunay3d/938/5 "2019-05-12T10:10:11Z")

</div>

Thank you for your responses; they are much appreciated.
