SHARE
TWEET

Untitled

advictoriam Jan 15th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Geometry
  2. {
  3.    /**
  4.       Computes the area of a triangle
  5.       @param x1 the x-coordinate of the first corner
  6.       @param y1 the y-coordinate of the first corner
  7.       @param x2 the x-coordinate of the second corner
  8.       @param y2 the y-coordinate of the second corner
  9.       @param x3 the x-coordinate of the third corner
  10.       @param y3 the y-coordinate of the third corner
  11.       @return the area of the triangle
  12.    */
  13.    public static double triangleArea(double x1, double y1,
  14.       double x2, double y2, double x3, double y3)
  15.    {
  16.       return Math.abs((x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)) / 2);
  17.    }
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top