Path: news.mathworks.com!not-for-mail
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$1@fred.mathworks.com>
References: <ho1k5u$hsc$1@fred.mathworks.com> <ho1ocu$ldr$1@fred.mathworks.com> <ho1pvj$cbr$1@fred.mathworks.com> <ho1rq8$8rk$1@fred.mathworks.com> <ho1u8b$dfi$1@fred.mathworks.com> <ho24mk$mb1$1@fred.mathworks.com> <ho331t$au1$1@fred.mathworks.com> <ho427a$7d4$1@fred.mathworks.com> <ho6e77$p2h$1@fred.mathworks.com> <ho6g8s$os1$1@fred.mathworks.com> <ho75n5$b42$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1269363803 19821 172.30.248.38 (23 Mar 2010 17:03:23 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 23 Mar 2010 17:03:23 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:619452

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <ho75n5$b42$1@fred.mathworks.com>...
> 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