CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Main CFD Forum (http://www.cfd-online.com/Forums/main/)
-   -   area of triangle (http://www.cfd-online.com/Forums/main/3552-area-triangle.html)

clifford bradford June 1, 2001 15:27

area of triangle
 
How do I find the area of a triangle in 2-D if I know the coordinates of the corners?

bronze June 1, 2001 15:36

Re: area of triangle
 
use Heron's law:

a^2 = s(s-a)(s-b)(s-c)

a=area a,b,c = side lengths s=0.5*(a+b+c)

(works well for 3-d too)

bronze June 1, 2001 15:38

Re: area of triangle
 
http://www.cs.mtu.edu/~shene/COURSES...06/area-3.html

The method and the code :)

Sid June 1, 2001 18:05

Re: area of triangle
 
The three vertices are ordered in counterclockwise order, (x1,y1), (x2,y2), (x3,y3). Then,

S=0.5*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2))

which can be derived easily by computing a cross product of a parir (any pair) of the side vectors.

Bye

clifford bradford June 1, 2001 19:38

Re: area of triangle
 
Aha! Thanks.

Barry June 2, 2001 10:33

Re: area of triangle
 
Hi

The very best way to do it is to calculate the cross product using two vectors (sharing the same origen)(one of the corner vertex of the triangle) which forms the edges of the triangle. Half the norm of the resulting vector will give ya the surface area AND by doing so you already calculated a normal to the surface which ye want anyhow. Just make sure your convention is correct, otherwise your normal vector might point in the wrong direction.

Cheers Barry


All times are GMT -4. The time now is 02:35.