PDA

View Full Version : Calculating volume and/or area


jobw
02-28-2007, 11:55 PM
Any one know of any methods/plugins for calculation of areas or volume for meshes in max?
Im thinking its more of an archicad or solid works thing.
cheers and peace

TimWoods
03-03-2007, 05:13 PM
measure in the utilities does this. or atleast atempts to.

jobw
03-05-2007, 12:01 AM
hey thats exactly what i was after.

You sound suspicious on its accuracy ie "it attempts to".
Would you trust it.
I created a 1m cubed box and sphere and it gave both volumes correctly.
I would like to calculate some volumes of earth excavations based on contour data and se ctions

TimWoods
03-05-2007, 07:29 AM
like u said it works with simple objects. but reallly there is no way of knowing if its accurate with other hand made objects. 3dsmax isnt the most accurate of programs. autocad is floating point, and so is accurate to amazing decimal places, engineering software is the way forward for super accuracy. with max, well its a shot in the dark really. maybe someone else with internal knowledge of max can say just how accurate that tool is? its been there for ever.....you could email autodesk technical support i guess.

Bobo
03-06-2007, 05:34 AM
like u said it works with simple objects. but reallly there is no way of knowing if its accurate with other hand made objects. 3dsmax isnt the most accurate of programs. autocad is floating point, and so is accurate to amazing decimal places, engineering software is the way forward for super accuracy. with max, well its a shot in the dark really. maybe someone else with internal knowledge of max can say just how accurate that tool is? its been there for ever.....you could email autodesk technical support i guess.

The code I included in the MAXScript Reference that calculates Volume and Center Of Mass gives back PRECISELY the same results as the Max Measure Utility, so without seeing the plugin code I can be pretty sure both use the same approach.

The code works great for closed volumes, including complex ones. It calculates the volumes of all tetrahedra defined by each triangular face. (a tetrahedron is a simple solid that has four triangular sides). By adding these volumes together, the utility calculates the EXACT volume enclosed by the polygonal surface - but it does not respect any virtual curvature defined by smoothing groups, so the volume of a sphere primitive is a close approximation of the actual mathematical volume but never exactly the same, no matter how many segments you add. The method also takes into account "negative spaces" as some tetras come out with a negative sign and take care of any holes within the volume or of complex surfaces like torus and torus knot.

So as long as your mesh does not have any missing polygons and is a closed surface enclosing a valid volume, you could trust its findings. Trying to measure incomplete surfaces will obviously cause incorrect results - what you put in is what you get! The Teapot is for example an object you cannot measure correctly because it has more holes than swiss cheese, and even a set of degenerated faces with invalid vertex indices to add insult to injury.


As for the area, the Measure utility sums the area of all triangular faces, which is relatively easy as it is half of the cross product of two edges of a face. MAXScript also has a meshop.getFaceArea method which returns that value, so you can compare the result to the Measure Utility and you should get precisely the same result:

fn getSurfaceArea theObject =
(
local theArea = 0
local theMesh = snapshotasMesh theObject
local theCount = theMesh.numfaces
for f = 1 to theCount do
theArea += meshop.getFaceArea theMesh f
delete theMesh
theArea
)

TimWoods
03-06-2007, 10:54 AM
there u have it. cant argue with that...i will now start trusting it!

CGTalk Moderation
03-06-2007, 10:54 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.