[Bf-committers] Mesh surface and volume calculation

"Franz Münz" AntaresSith at gmx.de
Sat Nov 13 12:38:01 CET 2004


> I think this sounds interesting (although during a release is a 
> difficult time to post - as I've discovered - I've been told to come 
> back in 2 weeks ;-).  Maybe you could provide a website explaining the 
> algorithm you are using mathematically?

I know the next release is closing in. My post was just a basic request for
feedback and if more work in this direction from my side would be
worthwhile. It's also about getting involved a little bit with blender ^^
because i really WANT to contribute something in the future :)

The argorithms are VERY simple. For the volume read this:

http://www.gamedev.net/community/forums/topic.asp?topic_id=279606 
(see last post; provided by z3r0_d in blender.org forum)

The surface is calculated for each triangle by:
S = 0.5*x*y*sin(z)
where a,b are the length of two side of the triangle and sin(c) the angle
created by those sides. I am using:
 
          a * b
cos(z) = -------
         |a|*|b|

where a,b are the vectors spanning the angle.

>     1. How does the code work with subdivision meshes?  

not at all at the moment, but that's something i thought about for the
future.

>     2. How does it handle volume calculations for "open" meshes (ones 
> which have no clearly defined "inside" and "outside")?  Does it detect 
> that they are open and refuse to proceed, or is there some arbitrary 
> closure condition applied?

"open" meshes obviously have no volume but they can still be calculated.
because an open mesh lacks some faces a closed mesh would have and the
calculation is done by including the origin (0, 0, 0) the result depends on
the distance to the origin.
a "solution" for this would be the calulation of the "center" of a mesh and
then using this as a new origin. this way "lost" faces wont have too much
impact on calculation.

of course the surface is still correct for such meshes.

regards
Franz

-- 
NEU +++ DSL Komplett von GMX +++ http://www.gmx.net/de/go/dsl
GMX DSL-Netzanschluss + Tarif zum supergünstigen Komplett-Preis!


More information about the Bf-committers mailing list