Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Geometry
- {
- /**
- Computes the area of a triangle
- @param x1 the x-coordinate of the first corner
- @param y1 the y-coordinate of the first corner
- @param x2 the x-coordinate of the second corner
- @param y2 the y-coordinate of the second corner
- @param x3 the x-coordinate of the third corner
- @param y3 the y-coordinate of the third corner
- @return the area of the triangle
- */
- public static double triangleArea(double x1, double y1,
- double x2, double y2, double x3, double y3)
- {
- return Math.abs((x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)) / 2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement