I-NetGraFX
08-24-2009, 05:31 AM
Hi there!
I'd like to get the size of a poly face, of any kind like triangles, quadrangles, etc.
I must have overlooked it big times ... or it's simply not there ...
I've found this in the docs, but it calculates the entire surface:
# Local and World Space Area
cmds.polyCube( w=1, h=1, d=1, sx=1, sy=1, sz=1, ax=(0, 0, 1), cuv=1, ch=1 )
cmds.setAttr( 'pCube1.scaleY', 2 )
cmds.polyEvaluate( a=True )
# Result: 6
cmds.polyEvaluate( wa=True )
# Result: 10
I've found various weird methods on the net, where some tried to triangulate it and calculate it after somehow like this, by summing up the resulting area from each triangle:
area = 0.25 * math.sqrt((a+b+c) * (b+c-a) * (c+a-b) * (a+b-c))
any pointers on how to get this without strange workarounds, where I'm forced to manipulate my object?
Your help is very much appreciated, thanks in advance!
I'd like to get the size of a poly face, of any kind like triangles, quadrangles, etc.
I must have overlooked it big times ... or it's simply not there ...
I've found this in the docs, but it calculates the entire surface:
# Local and World Space Area
cmds.polyCube( w=1, h=1, d=1, sx=1, sy=1, sz=1, ax=(0, 0, 1), cuv=1, ch=1 )
cmds.setAttr( 'pCube1.scaleY', 2 )
cmds.polyEvaluate( a=True )
# Result: 6
cmds.polyEvaluate( wa=True )
# Result: 10
I've found various weird methods on the net, where some tried to triangulate it and calculate it after somehow like this, by summing up the resulting area from each triangle:
area = 0.25 * math.sqrt((a+b+c) * (b+c-a) * (c+a-b) * (a+b-c))
any pointers on how to get this without strange workarounds, where I'm forced to manipulate my object?
Your help is very much appreciated, thanks in advance!
