Convex hull not fitting well to my data
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 229
- PR merge metrics
- No merged PRs in 30d
Description
Greetings!
I think my issue is not a bug or a feature request; I am looking for help with a problem for my specific data set and how I am setting up the problem.
I have a point cloud in CSV format (I uploaded it as .xlsx because Github wouldn't let me upload a .csv):
[deposit.xlsx](https://github.com/daavoo/pyntcloud/files/5324170/deposit.xlsx)
This is (X,Y,Z) data from a scanner that describes a surface of an object.
I can plot it with this code:
```python
import matplotlib.pyplot as plt
import pandas as pd
df=data
df.columns=["X","Y","Z"]
fig = plt.figure()
ax = fig.gca(projection='3d')
ax.plot_trisurf(df['Y'], df['X'], df['Z'], cmap=plt.cm.viridis, linewidth=0.01)
plt.show()
```
The plot looks like this:

As you can see, it is mostly a cone, but there is some rough area near the base. Also, there are small features away from the cone. What I want is the volume of everything that is above the z=0 plane.
I downloaded Pyntcloud after I saw this stack overflow post: https://stackoverflow.com/questions/44997054/point-cloud-to-volume I am following the same procedure.
I use the following code:
```python
from pyntcloud import PyntCloud
deposit = PyntCloud.from_file("deposit.csv")
convex_hull_id = deposit.add_structure("convex_hull")
convex_hull = deposit.structures[convex_hull_id]
deposit.mesh = convex_hull.get_mesh()
deposit.to_file("deposit.ply", also_save=["mesh"])
volume = convex_hull.volume
```
However, when I do this, I am not getting a mesh of my object. Instead, the system creates a pyramid, with the max height of my object as the vertex. The mesh looks like this:

By the way, I know the answer to what the volume should be. It should be about 22. Does anyone see what I've overlooked? Do I need a finer mesh to capture the features of my surface?
Thanks,
Eric
Contributor guide
Assessment
This issue has not been assessed yet.