Advertisement

3D triangle surface

Started by June 19, 2003 01:04 PM
20 comments, last by Vich 21 years, 7 months ago
Thanks for your help people!

Here's my result, perhaps someone else can benefit from it:

float TriangleSurfaceSize(CVector3 triangle[3]){    float result = Dot(triangle[1]-triangle[0], triangle[2]-triangle[0]);    if (result < 0.0f)        result *= -1.0f;    result /= 2;    return result;}



[edited by - Vich on June 19, 2003 5:14:46 PM]
[www.LifeIsDigital.net - My open source projects and articles.
I always thought that the area of a triangle was the magnitude of the CROSS product of two edges of the triangle (all divided by two) instead of the DOT product.

The formula that the AP posted is still correct

Area(A,B,C)=|(B-A) x (C-A)|/2

But that''s the cross product, and the | | bars indicate that you take the LENGTH of the cross product. Then divide by two

Josh
Advertisement
Yes, the area of a triangle is half the magnitude of the cross product of any two edges.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Wait a minute. Think about what directxxx said: area is a scalar quantity. Why does the cross product, a vector result, give the area?
You know what I never noticed before?
CrossProduct of anytwo edges gives a vector. now get the MAGNITUDE of that vector. The half of that mag is area. Correct me if im wrong.
3D Side-Scroller game demo Project-X2 "playable"Lashkar: A 3D Game & Simulation Project demo @ lashkar.berlios.de
Yes, you are right. Sorry, it was very late...
You know what I never noticed before?
Advertisement
So it should be this instead?

float TriangleSurfaceSize(CVector3 triangle[3]){    // area(A,B,C) = |(B-A) x (C-A)| / 2    float result = Magnitude(Cross(triangle[1]-triangle[0], triangle[2]-triangle[0]));    result /= 2;    return result;}
[www.LifeIsDigital.net - My open source projects and articles.
yeah, that''s good.
You know what I never noticed before?
Vanilla,
Area is a vector quanity. If you have done vector calculus and stuff with gausses law, this may or may not be familiar.

Edit: changed wording to how I would normally talk.

[edited by - Punty50 on June 25, 2003 4:34:06 PM]
Brendan"Mathematics is the Queen of the Sciences, and Arithmetic the Queen of Mathematics" -Gauss
Area is a scalar variable. Gauss''s law is about flux, which is area x electric field in the direction of the perpendicular.

Sure, to get this you can treat area as a vector of the same magnitude and normal direction, and then use the dot product, but that does not detract from the fact it is a scalar quantity, and that the maths works without vectors (though becoming so hard as to be insoluble in most cases).
The same applies for vector calculus, where I thinkthe only application is surface integrals, also involving the dot product.

If you say area is a vector, then you are saying two congruent triangles can have different area''s.

This topic is closed to new replies.

Advertisement