# Calculating area for triangular geometries

Is there a function suitable for calculating areas for geometries involving triangles?

I have used the formula for the area of the triangle.

p1={0,0};
p2={24,50};
p3={86,110};
p4={120,0};
pointDistance=RegionNearest[Line[{p3,p4}],p2];
lineBlack=Line[{p1,p2,p3,p4,p1}];
lineRed={Dashed,Red,Line[{p2,p4}]};
lineDistance={Dashed,Red,Line[{p2,pointDistance}]};
Graphics[{lineBlack,lineRed,lineDistance}]
area1=(EuclideanDistance[p1,p4]*p2[[2]])/2//N
area1=(EuclideanDistance[p2, pointDistance]*EuclideanDistance[p3, p4])/2//N
areaTotal=area1+area2


• Very intelligent reasoning, but the code is very large. Commented Dec 7, 2016 at 15:06
• I also found it, but I had no idea of ​​the possibilities
– user45104
Commented Dec 7, 2016 at 15:07

You can use the function Polygon and function Area where this use "Region".

poly = Polygon[{p1, p2, p3, p4}];
Graphics[poly]


Area[poly]


7430

To extend the example:

Using PolygonDecomposition: (introduced 2019, v12.0)

p1 = {0, 0};
p2 = {24, 50};
p3 = {86, 110};
p4 = {120, 0};
poly = Polygon[{p1, p2, p3, p4}];
pd = PolygonDecomposition[poly, "Triangle"];

SeedRandom[1];
Graphics[{
Text[#, #] & /@ PolygonCoordinates@poly
, Text[Style[ToString@#2 <> "-" <> ToString@Area@#3, Black, 14],
RegionCentroid@#3]
} &
, {RandomColor[Length@pd]
, Range[1, Length@pd]
, pd}
]
}]


{#, Total@#} &@Area@pd


{{3000, 4430}, 7430}