From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Area integral over a triangle in MATLAB -- is numerical integration possible?
Date: Tue, 23 Mar 2010 17:03:23 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 21
Message-ID: <hoas8r$jbd$>
References: <ho1k5u$hsc$> <ho1ocu$ldr$> <ho1pvj$cbr$> <ho1rq8$8rk$> <ho1u8b$dfi$> <ho24mk$mb1$> <ho331t$au1$> <ho427a$7d4$> <ho6e77$p2h$> <ho6g8s$os1$> <ho75n5$b42$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1269363803 19821 (23 Mar 2010 17:03:23 GMT)
NNTP-Posting-Date: Tue, 23 Mar 2010 17:03:23 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:619452

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ho75n5$b42$>...
> One way to check the correctness of the parametrization is to integrate a polynomial P(x) on the triangle. If P(x) the polynomial of
> - order 0: the integral result is P(x1)*|T|
> - order 1; the integral result is (P(x1)+P(x2)+P(x3)) * |T|/3 
> etc...
> x1, x2, x3 are three corners, and |T| is the area of triangle
> Once the implementation gives correct result, you can then replace P(x) by your function.
> Bruno
  Hi Bruno.  Your "etc..." intrigued me, so I worked out what the "order 2" test would be.  I wasn't aware of this identity before.  What would an order 3 test be?

  The double integral of any quadratic polynomial,

 P(x,y) = A*x^2+B*x*y+C*y^2+D*x+E*y+F ,

over a triangle is equal to the triangle's area, multiplied by one quarter of the polynomial's average value at the three vertices plus three quarters of its value at the triangle's centroid (located at the averages of the three respective coordinates.)

Roger Stafford