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!
  • 111 Lisa via Digitalmars-d-learn
    • Re: 111 cym13 via Digitalmars-d-learn
      • Re: 111 Lisa via Digitalmars-d-learn
        • Re: 111 Chris Wright via Digitalmars-d-learn
          • Re: 111 Lisa via Digitalmars-d-learn
            • Re: 111 Chris Wright via Digitalmars-d-learn
              • Re:... Adam D. Ruppe via Digitalmars-d-learn
        • Re: 111 cym13 via Digitalmars-d-learn
    • Re: 111 Ivan Kazmenko via Digitalmars-d-learn
    • Re: 111 Ali Çehreli via Digitalmars-d-learn
      • Re: 111 Lisa via Digitalmars-d-learn
      • Re: 111 Lisa via Digitalmars-d-learn
        • Re: 111 Ali Çehreli via Digitalmars-d-learn
          • Re: 111 Lisa via Digitalmars-d-learn
            • Re: 111 Steven Schveighoffer via Digitalmars-d-learn
            • Re: 111 Ivan Kazmenko via Digitalmars-d-learn
              • Re:... Lisa via Digitalmars-d-learn

Reply via email to