script (MEL) |
Only available in MEL |
computePolysetVolume |
In categories: Modeling, Polygons |
Go to: Synopsis. Return value. MEL examples.
computePolysetVolume
Prints the total volume of all polysets on the pick list.
For accurate results the geometry should be closed, with no
holes or minimal gaps and no interpenetrating surfaces( such as
as two overlapping spheres ).
The method uses the divergence theorem:
\int_{vol} Div(f) dV = int_{surf} Dot(f,n) dS
To use it to compute volumes set f=(0,0,z), you then have
Volume = \int_{vol} 1 dV = int_{surf} n_z(u,v) du dv
Where n_z is the "z" component of the normal to the surface at the parameter value (u,v).
If you only have triangles then the formula reads:
Volume = sum_{over all triangles} (z0+z1+z2)/3*n_z*A
None
Arguments
Variable Name |
Variable Type |
Description |
| | None.
|
// Create a poly cube and find its volume
polyCube;
// Result: pCube2 polyCube1 //
computePolysetVolume;
// pCube3 faces = 6 //
// TOTAL VOLUME = 1 //