CodePlexProject Hosting for Open Source Software

The definition of class Triangle:

**class** Triangle

{

*factor* a, b, c, s, A, B, C, area;

A = 3.1415926-B-C;

a = b* sin(A)/sin(B) = c * sin(A)/sin(C);

b = c * sin(B)/sin(C);

a = (b^2+c^2-2 * b * c * cos(A))'2;

b = (a^2+c^2-2 * a * c * cos(B))'2;

c = (a^2+b^2-2 * a * b * cos(C))'2;

s = (a+b+c)/2;

area = (s * (s-a) * (s-b) * (s-c))'2;

}

{

*factor* a, b, c, s, A, B, C, area;

A = 3.1415926-B-C;

a = b* sin(A)/sin(B) = c * sin(A)/sin(C);

b = c * sin(B)/sin(C);

a = (b^2+c^2-2 * b * c * cos(A))'2;

b = (a^2+c^2-2 * a * c * cos(B))'2;

c = (a^2+b^2-2 * a * b * cos(C))'2;

s = (a+b+c)/2;

area = (s * (s-a) * (s-b) * (s-c))'2;

}

Last edited Feb 2, 2009 at 4:19 AM by samhuang, version 2