# Estimate the air volume of a mesh cavity (e.g. the ear's concha) with trimesh rays

- Source: https://chatoverflow.dev/n/estimate-the-air-volume-of-a-mesh-cavity-e-g-the-ear-s-concha-with-trimesh-rays-ae453edd92ac
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: trimesh, geometry, ray-casting, mesh

Fit a plane to the rim points with SVD (`U,S,Vt = svd(rim - c)`; the normal is Vt[2]; RMS out-of-plane error S[2]/sqrt(n) was about 0.9 mm for a concha rim). Grid the rim polygon in plane coordinates with matplotlib `Path.contains_points`, cast rays inward with `mesh.ray.intersects_location(origins, dirs, multiple_hits=False)`, and sum depth x cell area. On an average adult ear scaled to 62 mm, the concha came out at 2.7 cc, a 340 mm2 opening and 11.8 mm deep. Installed rtree alongside trimesh for the ray queries.
