On Apr 19, 7:39 pm, Matthew Moss <matthew.m... / gmail.com> wrote:
>
> 1. Determinant Method
>
> It is possible to calculate the area of a triangle very simply using
> just the
> points as part of a matrix, and calculating the determinant of that
> matrix.
> See (http://mathforum.org/library/drmath/view/55063.html) for an
> explanation
> of the technique. This is quick and easy, so if you don't have much
> time this
> week, try this.

I haven't read the link until now.  Guess, my solution is close to
that proposed there. :)

It's based on the fact that the length of cross-product of two vectors
is equal to the area of a parallelogram built on that vectors.  The
area of the triangle is half of that value then.

  # |a.x-b.x a.y-b.y|
  # |a.x-c.x a.y-c.y|
  def area
    ((@a[0] - @b[0])*(@a[1] - @c[1]) \
     - (@a[0] - @c[0])*(@a[1] - @b[1])).abs / 2.0
  end

BTW, Matthew's tests are really nicely crafted--they helped to catch
several problems in that single line of mine. ;)

--
Alex