We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Calculating the area of a shape in 3D
Page Index Toggle Pages: 1
Calculating the area of a shape in 3D? (Read 489 times)
Calculating the area of a shape in 3D?
Jul 17th, 2008, 11:44am
 
Does anyone know how I would calculate the area of this shape?

beginShape();
vertex(x,  y,  z);
vertex(x2, y2, z2);
vertex(x3, y3, z3);
vertex(x4, y4, z4);
endShape();

I already have this calculate distance function to use

float calculateDistance(float x1,float y1,float z1,float x2,float y2,float z2){
float dx = x1-x2;
float dy = y1-y2;
float dz = z1-z2;
float distance = sqrt(dx*dx + dy*dy + dz*dz);
return distance;
}


Thanks in advance!
Re: Calculating the area of a shape in 3D?
Reply #1 - Jul 17th, 2008, 8:18pm
 
are the 4 points guaranteed to be in the same plane?

is it guaranteed to be a convex shape?

i am thinking that any quad (event the concave case) is the sum of two triangles. but you'd still need to work out the height of the two triangles (and, if it's concave, how to split it sensibly, which might be where the distance function comes in)

area formula:
http://mathforum.org/dr.math/faq/formulas/faq.quad.html

but that might be for convex, planar objects only...
Page Index Toggle Pages: 1