111

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 19 16:50:24 PST 2016


On Saturday, 20 February 2016 at 00:42:36 UTC, Chris Wright wrote:
> How do you calculate the area of a triangle? Same way as you'd 
> do it by hand -- 1/2 base times height.

Getting the height can be tricky sometimes though, depending on 
what information you know about the triangle.

I like to check wikipedia for refreshers on math tricks.

https://en.wikipedia.org/wiki/Triangle#Computing_the_area_of_a_triangle

There's formulas to follow for almost any kind of input there... 
and if you have to get perimeter anyway, you are already 
calculating the lengths of the sides, so I'd use the convenient 
formula in there based on those very lengths!


More information about the Digitalmars-d-learn mailing list