Heron's Formula vs Area by Vertices
There are several ways to determine the area of a triangle.
With side lengths A, B, and C, the area is:
Area = √( S * (S - A) * (S - B) * (S - C) )
where S = (A + B + C) / 2
Area of Vertices:
With vertices (x1, y1), (x2, y2), and (x3, y3), the area is:
Area = 1/2 * abs( (x1 - x2) * (y1 + y2) + (x2 - x3) * (y2 + y3) + (x3 - x1) * (y3 + y1) )
Testing The Data
I ran a test of 50 randomly selected sets of three points that form the triangle. The three points are:
* The origin: (0,0)
* The second point has 0 ≤ x ≤ 20 and -20 ≤ y ≤ 20, x and y are integers
* The third point has 0 ≤ x ≤ 20 and 0 ≤ y ≤ 20, x and y are integers
I used the Casio fx-9750gIII Spreadsheet application.
Casio Spreadsheet Set Up
Column Titles - Row 1:
Column A: "X1" x coordinate of point 1
Column B: "Y1" y coordinate of point 1
Column C: "X2" x coordinate of point 2.
Column D: "Y2" y coordinate of point 2
Column E: "X3" x coordinate of point 3
Column F: "Y3" y coordinate of point 3
Column G: "XY1" distance between points 1 and 2
Column H: "XY2" distance between points 2 and 3
Column I: "XY3" distance between 3 and 1
Column J: "S" semi-perimeter of the triangle
Column K: "HERON" Area by Heron's Formula
Column L: "VERT" Area by Vertices
Column M: "DIFF" Difference between two calculation methods
Formulas for Rows 2 through 51
Column A: A2 = Fill(0,50)
Column B: B2 =Fill(0,50)
Column C: C2 =Seq(Int(22 Ran#) - 1,X,1,50,1)
Column D: D2 =Seq(Int(41 Ran#) - 21,X,1,50,1)
Column E: E2 =Seq(Int(22 Ran#) - 1,X,1,50,1)
Column F: F2 =Seq(Int(22 Ran#)-1, X,1,50,1)
Column G: G2 Fill: =√(C2^2 + D2^2) for range G2:G51*
Column H: H2 Fill: =√((C2-E2)^2 + (D2-F2)^2) for range H2:H51
Column I: I2 Fill: =√(E2^2 + F2^2) for range I2:I51*
Column J: J2 Fill: =(G2 + H2 + I2) ÷ 2 for range J2:J51
Column K: K2 Fill =√(J2 (J2 - G2) (J2 - H2) (J2 - I2) ) for range K2:K51
Column L: L2 Fill =0.5 × Abs( (A2 - C2)(B2 + D2) + (C2 - E2)(D2 + F2)
+ (E2 - A2)(F2 + B2)) for range L2: L51
Column M: M2 Fill =K2-L2
* To take advantage that the first point is (0, 0). The full distance formula would be needed otherwise.
This spreadsheet implies that there is no "rounding" the middle results.
If you want to download the spreadsheet results, click here:
The zip file contains two images, a csv file, and a Casio spreadsheet file that can be ran on Casio calculators with a spreadsheet application.
Of the sample taken, the areas determined by Heron's Formula and Area by Vertices are substantially equal; any difference is the order of 10^-12.
All original content copyright, © 2011-2020. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.