Triangle area

Started by
4 comments, last by coder0xff 17 years, 12 months ago
This topic is somewhat old I'm sure: Computing the area of a triangle in planar space (2 dimensional) is simple: for a triangle (x1,y1) - (x2, y2) - (x3, y3) V = 1/2((x2 - x1)(y3 - y1) - (x3 - x1)(y2 - y1)) //It is half the perp dot product of two edges The best I've come up with for 3 dimensional is this: //First get vectors for two edges of the triangle U.x=x2-x1: U.y=y2-y1: U.z=z2-z1 V.x=x3-x1: V.y=y3-y1: V.z=z3-z1 D.x = U.y*V.z-V.y*U.z: D.y = V.x*U.z-U.x*V.z: D.z = U.x*V.y-V.x*U.y Area = sqrt(D.x^2 + D.y^2 + D.z^2)/2; in notation A=|UxV|/2 Essentialy this is half the magnitude of the cross product of the two vectors. So my wonder is, why should we need to use a square root operation to obtain the area of a triangle in 3D.
Two things are infinite: the universe and human stupidity; and Im not sure about the universe. -- Albert Einstein
Advertisement
If you use the 3D form for a triangle in the XY plane, you will see that the result is:

Area = sqrt( Dz2 )/2 = Dz/2,

which is the same as the 2D form.


John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
I don't understand... the square root is of the sum of three seperate monomials... once there is adddition in the radicand square roots cannot be factored out. Is that what you meant?
Two things are infinite: the universe and human stupidity; and Im not sure about the universe. -- Albert Einstein
JohnBolton was assuming your original triangle was restricted to the XY plane, in which case the cross product vector would only have a non-zero Z component. Thus you can eliminate the square root because X and Y are automatically 0.

For the general case 3D, you indeed need to use a square root to find the length of the cross product vector, and divide it by 2.
I interpreted your question as "Why is a square root needed in 3D but not in 2D?" I was trying to show that the 2D case does use square root, but since it reduces to the square root of a squared value, the two cancel each other out.

You can change a 3D problem into a 2D problem if you fix one of the axes to a constant value. In the XY plane (z = 0),
    D.x  = U.y*V.z-V.y*U.z = 0    D.y  = V.x*U.z-U.x*V.z = 0    D.z  = U.x*V.y-V.x*U.y    Area = sqrt(D.x^2 + D.y^2 + D.z^2)/2         = sqrt(0 + 0 + D.z^2)/2         = sqrt(D.z^2)/2         = D.z/2 
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
OK... :-)
Two things are infinite: the universe and human stupidity; and Im not sure about the universe. -- Albert Einstein

This topic is closed to new replies.

Advertisement