Hello I am trying to write a java program that takes three points (a,b, and c) and finds the area of a triangle. I am getting stuck because I don't know the coordinates of the points (they will be given later in a tester class). Should i write the code to convert the points to cartesian coordinates and then use those to find the area? Im really stuck on this so any suggestions will help. Thanks.
Asked
Active
Viewed 1,303 times
1
-
1"Should i write the code to convert the points to cartesian coordinates" What in your view is the difference between a point and cartesian coordinates? – weston Jan 25 '16 at 08:11
-
@weston the points I have are Point a, Point b, Point C. I don't know how to convert this to say (Ax,Ay),(Bx,By). Does that make sense? – J.Daniels Jan 25 '16 at 16:16
-
@Tim thank you, thats exactly what I was looking for! – J.Daniels Jan 25 '16 at 16:18
-
No it makes no sense to convert as a point already has X and Y parts. – weston Jan 25 '16 at 22:52
1 Answers
2
A compact and nicely symmetric way to remember the area formula is
[ 1 a.x a.y ]
area = 0.5*det[ 1 b.x b.y ]
[ 1 c.x c.y ]
This will give a signed area, negative if the order of the vertices is clockwise. For implementations one of course simplifies the determinant by row and column operations.

Lutz Lehmann
- 25,219
- 2
- 22
- 51