Hello,
So I am trying to find an efficient way to calculate the volume between planes (e.g. the ones in the image). The planes are not parallel with one another, and I have not found any resources online that have been helpful. I was wondering if there is a julia package that is capable of doing something like this, or if not, some advice on calculating 3d object would be great.
Thanks!
Do you mean the volume of the convex hull of the shapes, or, if the planes were representing motion in space, the lines that connect the nearby vertices to form a hexahedron? Depending on how you wanted the shapes to be “skinned” you could get a few different answers.
I mean that if each of vertices were connected with a line to a neighboring plane to form a hexahedron, and then calculating the volume in between each pair individually.
Ok, if you have the data as a sequence of quadrilaterals, you could compute the volume between them as tetrahedrons … sort of like in this SO question. I could probably hack something together if the information in the link is unclear.
EDIT: This OSTI link has the formulas in it as well.
You can also create a Meshes.jl Hexahedron
and ask for the volume
.
1 Like
So using meshes looks like it might work, but when I use Hexahedron(planeCornerPoints) I get this weird gap in the mesh:
The little gray dots are the points I’m using vertices. Getting the volume is then as simple as doing: measure(Hexahedron(planeCornerPoints)).
Not sure if this is a visual bug…
This might work, but I am feeling lazy and have already poured a lot of work into a package that’s purpose has very little to do with this. So I was just hoping to use some pre-built julia package. I think Meshes.jl might be a good solution.
Pay attention to the expected order of vertices in the Hexahedron constructor. Check the examples and tests.
1 Like
yes, that worked perfectly, thank you.
1 Like