I am using geom3d to model 3D geometric shapes. Specifically, I am interested to calculate a volume of the ellipsoid after slicing it with an arbitrary plane. I am using the following code (here for simplicity I will use a sphere and cut it in the center).
[x, y, z] = sphere(30);
[f, v, c] = surf2patch(x, y, z, z, 'triangles');
meshVolume(v, f)
This calculates a volume of a sphere as expected (4/3*pi).
Now, I slice it in half.
P = createPlane([0, 0, 0], [0, 0, 1]);
[v1 f1] = clipConvexPolyhedronHP(v, f, P);
drawMesh(v1, f1, 'facealpha', 0.5)
Now if I calculate the volume, I get incorrect value (significantly smaller than half of the initial volume).
meshVolume(v1, f1)
What is the reason for the incorrect result?