# Help getting CSV files of spheres to work with Delaunay 3D

**URL:** https://discourse.paraview.org/t/help-getting-csv-files-of-spheres-to-work-with-delaunay-3d/1818
**Category:** ParaView Support
**Created:** [May 10, 2019, 8:47am UTC](https://discourse.paraview.org/t/help-getting-csv-files-of-spheres-to-work-with-delaunay-3d/1818 "2019-05-10T08:47:48Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Diepferd](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Diepferd](https://discourse.paraview.org/u/Diepferd)
#### Post date: [May 10, 2019, 8:47am UTC](https://discourse.paraview.org/t/help-getting-csv-files-of-spheres-to-work-with-delaunay-3d/1818/1 "2019-05-10T08:47:48Z")

</div>

Hey

I have been working on generating a solid sphere based on multiple CSV files (+10) with a lot of rows /data points(16000+ for each CSV file).

The CSV files contain 4 variables X,Y,Z and a Value. Each CSV file represents a layer.

I have successfully made connected spheres using Delaunay 2D(splitting up the data-set to overcome the convex problem), but can’t make Delaunay 3D work it crashes every time just giving me a blank error message.

I think one of the main issues is that i don’t have data in the center of my model (think jawbreaker candy with an empty center) i have no idea how to deal with this problem, I have tried adding a neutral center, doing only one layer and adding smaller ‘‘fake’’ layers in the inner part but it seems that Delaunay 3D just can’t handle this much data, or hopefully I’m just doing something wrong.  
Any help would be much appreciated

Thank you for reading.

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [May 13, 2019, 3:01pm UTC](https://discourse.paraview.org/t/help-getting-csv-files-of-spheres-to-work-with-delaunay-3d/1818/2 "2019-05-13T15:01:20Z")

</div>

Having an empty center should be OK (although it can give you weirdly shaped tetrahedra and might contribute to precision problems). Something else is probably going wrong. Perhaps you have coincident points that are throwing off the Delaunay 3D computation. Can you try running your data through the Clean filter with a small but positive tolerance to merge points?

It might help if you can post some data.

---

<div class="post-metadata">

### Author: ![Diepferd](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Diepferd](https://discourse.paraview.org/u/Diepferd)
#### Post date: [May 15, 2019, 7:33am UTC](https://discourse.paraview.org/t/help-getting-csv-files-of-spheres-to-work-with-delaunay-3d/1818/3 "2019-05-15T07:33:43Z")

</div>

Hey Kenneth

Clean filter worked very well, now i can actually make a solid sphere.  
Big problem though it comes out like this:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/7/71b85af18e379c66198cea0e4eb8dd2f50f9f627.png)  
Which isn’t how it is suppose to look like. This is some of the data I’m working with i have about 20 more of these kind of CSV files , [Seismictomo2750XYZV.csv](https://discourse.paraview.org/uploads/default/original/2X/c/c2adf7c328e99e309595dcf359461ba0628dc548.csv) (1.0 MB)  
[Seismictomo2890XYZV.csv](https://discourse.paraview.org/uploads/default/original/2X/9/9ffcb825adb6f8e2f12e03d036a926c83fcfbf0f.csv) (1.0 MB)

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [May 15, 2019, 6:52pm UTC](https://discourse.paraview.org/t/help-getting-csv-files-of-spheres-to-work-with-delaunay-3d/1818/4 "2019-05-15T18:52:33Z")

</div>

After playing with your data a little bit, I realized that the problem is that the Delaunay 3D filter is having troubles because the Delaunay triangulation is ill defined for points on the surface. The Delaunay triangulation is defined as the set of tetrahedra where the circumsphere of each tetrahedron contains no other points in the set. The problem is that because all points are on the same sphere, the circumsphere of any 4 points contains all the other points, so the algorithm runs into all kinds of precision problems.

The easiest solution is to perturb the points a little bit so that they do not all lie in the same sphere. You can do this with the following operations.

1. Add the `Random Vectors` filter to your points. The points in your data set are are about 7000 units in diameter, so the default magnitude of 0 to 1 seems to work OK.
2. Add the `Warp By Vector` filter. You should be warping by the `BrownianVectors` field created by the `Random Vectors` filter.
3. Add the `Delaunay 3D` filter.

This seems to work pretty well. There are some disadvantages, though. First, the triangulation is based on random movements, so it will be a little different every time. Second, you have to warp the mesh a little bit to get it to work. Visually, I can’t tell the difference, but that might be an issue. Third, the Delaunay triangulation still has a tendency to create long triangles that stretch across the diameter of the sphere.

Anyway, here is the result I got after applying those steps:

 ![Capture](https://discourse.paraview.org/uploads/default/original/2X/6/67e70caeecc9e0d89d9f3086d8dad4359490d59a.png)

---

<div class="post-metadata">

### Author: ![Diepferd](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Diepferd](https://discourse.paraview.org/u/Diepferd)
#### Post date: [May 16, 2019, 9:03am UTC](https://discourse.paraview.org/t/help-getting-csv-files-of-spheres-to-work-with-delaunay-3d/1818/5 "2019-05-16T09:03:21Z")

</div>

It still does this, i think it is because all the spheres are trying to triangulate with it them selves, while what i need is for each layer to triangulate with the neighboring layers only.

 ![image](https://discourse.paraview.org/uploads/default/original/2X/9/9f1af681b8e8f3bd49639f8ea7e6aeb031f819a4.png)  
I think i need to make the dataset handle all the points as individual points, instead of points which are a part of a sphere or maybe Delauany 3D is not the answer?.  
Here is my whole data set:  
[XYZV.7z](https://discourse.paraview.org/uploads/default/original/2X/2/272a927683e1353b4a74b7814fd78c7440675eba.7z) (2.1 MB)

Thank you so much for taking the time to help me Kenneth.

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [May 17, 2019, 8:59pm UTC](https://discourse.paraview.org/t/help-getting-csv-files-of-spheres-to-work-with-delaunay-3d/1818/6 "2019-05-17T20:59:53Z")

</div>

OK, I misunderstood that you are combining multiple csv files together. I see from your screen shot that you are using group datasets. Although that combines data from different readers into a single data set, it does so into a multi-block data set that keeps each input separate. Thus, when you run the `Delaunay 3D` filter on that multi-block data set, it runs it independently on each block. Since the data are on concentric circles, it generates overlapping tetrahedra throughout the interior of the sphere.

The solution is to run the `Merge Blocks` filter after the data are grouped and `Table To Points` is run. This will bring all the points into a single data set so that `Delauny 3D` can run on them all.

Also, here is another trick. If you want to easily load all of your csv files at once, first load them as a time series (click the file group in the file browser when you are opening the data). Then run the `Group Time Series` filter. That will load up all the data in the time series and create a single multi-block data set of all time steps. (Then run the `Merge Blocks` filter on that and then the subsequent random permutation.) Executing `Delauny 3D` on the data in all 23 files may take a while (it took about 20 minutes on my laptop), but it seems to work OK. Here is a screenshot:

 ![32%20PM](https://discourse.paraview.org/uploads/default/original/2X/0/007405450aff691d0162e79501aeadc8b7b7f8be.jpeg)

And here is a state file for everything that I did: [read-all-seismictomo.pvsm](https://discourse.paraview.org/uploads/default/original/2X/1/15e0fb7c0200c9a5705a3f1f3831cf24bd588055.pvsm) (726.6 KB)
