Double integral over triangle with known nodes

Click For Summary

Discussion Overview

The discussion revolves around finding analytic solutions for double integrals over a triangle defined by its vertices (x1,y1), (x2,y2), and (x3,y3). The integrals in question include the first and second moments of area, specifically integrals of the forms Integral(xdxdy), Integral(ydxdy), Integral(x^2dxdy), Integral(y^2dxdy), and Integral(xydxdy). Participants explore various methods and approaches to compute these integrals.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Exploratory

Main Points Raised

  • One participant suggests a method based on integrating over different cases depending on the relative positions of the triangle's vertices, providing a specific integral setup for the first moment of area.
  • Another participant expresses a need for a universal solution and describes a method using a transformation to parameters u and v, along with MATLAB code to compute the integral of x^2 + y^2 over the triangle.
  • A subsequent post refines the transformation and integral setup, providing additional details on the area calculation and the integrals involved, while also noting the importance of the orientation of the triangle's vertices.
  • Further elaboration on the integral calculations is provided, including the final expressions for the integrals without the original variables, focusing solely on the triangle's vertices.

Areas of Agreement / Disagreement

Participants present different methods and approaches to the problem, with no consensus on a single universal solution. Some methods are more specific to certain cases, while others aim for broader applicability.

Contextual Notes

Participants acknowledge the dependence on the orientation of the triangle's vertices and the specific cases of integration, which may affect the results. There are also unresolved mathematical steps and assumptions regarding the triangle's configuration.

Zhigang Wei
Messages
1
Reaction score
0
I am wondering is there any general analytic solutions to the following integrals

First moment of area
Integral(xdxdy)
Integral(ydxdy)

Second moment of area)
Integral(x^2dxdy)
Integral(y^2dxdy)
Integral(xydxdy)

Over the triangle (x1,y1) (x2,y2) (x3,y3)

thanks

Wei
 
Physics news on Phys.org
It looks like basic Calculus III with some attention to different cases (x1< x2< xc3 or x1< x3< x2, etc.).

Assuming that x1< x2< x3 and that y2 is larger than either y1 or y3, We can integrate from the line between (x1, y1) and (x3, y3) to the line between (x1, y1) to (x2, y2) for x going from x1 to x2, then from the line between (x1, y1) and (x3,y3) to the line between (x2,y2) and (x3,y3).

The line between (x1, y1) and (x3, y3) is given by y= y1+ ((y3- y1)/(x3-x1))(x- x1) and the line between (x1, y1) and (x2, y2) is given by y= y1+ ((y2- y1)/(x2- x1))(x- x1) so that first integral would be
[tex]\int_{x= x1}^{x2}\int_{y= y1+ ((y3- y1)/(x3- x1))(x- x1)}^{y1+ ((y2-y1)/(x2-x1))(x- x1)}f(x,y) dydx[/tex]
where f(x,y) is x, y, x^2, y^2, or xy.
 
I suppose this will work for given type of triangle, I am not going to check it. But most people need universal solution. I took me a lot of time to get to this and it works (all is written in Matlab code).

Lets say you have triangle (x1,y1) (x2,y2) (x3,y3) and you want to calculate integral I=x^2+y^2 over it.

First you need to declare:
x=(1-u)*x1+u*((1-v)*x2+v*x3);
y=(1-u)*y1+u*((1-v)*y2+v*y3);

Then simple do integral I1=u*I(v) from 0 to 1, and then I2=I1(v) from 0 to 1. And then you have to multiply result by 2 areas of triangle.

This works great for me i tested it, and I get great results. Matlab code would be something like this:

syms x1 y1 x2 y2 x3 y3 x y u v
x=(1-u)*x1+u*((1-v)*x2+v*x3);
y=(1-u)*y1+u*((1-v)*y2+v*y3);
A=(x2*y1 - x1*y2 + x1*y3 - x3*y1 - x2*y3 + x3*y2)/2;
%A is area (watch for orientation of nodes clockwise/counterclockwise
I=x^2+y^2;
I2=2*A*int(int(u*I,v,0,1),u,0,1);

Let me know what you think
 
x=(1-u)*x1+u*((1-v)*x2+v*x3);
y=(1-u)*y1+u*((1-v)*y2+v*y3);
%this way you went form x,y to u,v

I=x^2+y^2;
%concerning first change from x,y to u,v I should be:
%I=(u*(v*x3 - x2*(v - 1)) - x1*(u - 1))^2 + (u*(v*y3 - y2*(v - 1)) - y1*(u - 1))^2

A=(x2*y1 - x1*y2 + x1*y3 - x3*y1 - x2*y3 + x3*y2)/2;
%A is area of triangle (watch for orientation of nodes clockwise/counterclockwise not to get negative area)

I1=int(u*I,v,0,1);
%first integral ∫u*I(v) from 0 to 1
%solution is:
%I1=(u^3*(x2 - x3)^2)/3 + (u^3*(y2 - y3)^2)/3 + u*(u*x2 - x1*(u - 1))^2 + u*(u*y2 - y1*(u - 1))^2 - u^2*(u*x2 - x1*(u - 1))*(x2 - x3) - u^2*(u*y2 - y1*(u - 1))*(y2 - y3)
%notice that there is no longer v

I2=2*A*int(I1,u,0,1);
%twice area of triangle times second integral ∫I1(u) from 0 to 1
%solution is:
%I2=-(x1*y2 - x2*y1 - x1*y3 + x3*y1 + x2*y3 - x3*y2)*(x1^2/12 + (x1*x2)/12 + %(x1*x3)/12 + x2^2/12 + (x2*x3)/12 + x3^2/12 + y1^2/12 + (y1*y2)/12 + (y1*y3)/12 + y2^2/12 + (y2*y3)/12 + y3^2/12);
%finally you got solution without x, y, u or v just through nodes of triangle
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K