kill(all);

dichiaro le quote dimensionali essere ristrette in segno, in modo da avere
|x| = x

Dimensions are declared positive, in order to simplify abs(x) with x

assume(  b>0 , t>0 , h>0  );

considero per semplicità uno spessore costante t

For the sake of simplicity, wall thickness is assumed constant.

two coordinate systems are employed:

OXY is centered at the web midpoint
Gxy is centered at the (initially unknown) section center of gravity

coordinate dei punti nodali del profilo

profile nodal point coordinates according to the OXY reference system

XA : b $ YA: h/2$
XB : 0 $ YB: h/2$
XC : 0 $ YC:-h/2$
XD : b $ YD:-h/2$

derivo lunghezze dei tratti

profile segment lengths

l_AB : sqrt((XA-XB)^2 + (YA-YB)^2)$
l_BC : sqrt((XB-XC)^2 + (YB-YC)^2)$
l_CD : sqrt((XC-XD)^2 + (YC-YD)^2)$

coordinate, in funzione di un'ascissa curvilinea adimensionale xi in [0,1]

(x,y) coordinates for points along the profile segments are parametrically defined
with respect to a normalized arlength coordinate xi that spans from 0 to 1 
while moving along the segment from the first to the second endpoint.
The Gxy centroidal coordinate system is here employed, with unknown XG,YG. 

x_AB(xi) := (XB - XG) * xi + (XA - XG) * (1-xi) ;

y_AB(xi) := (YB-YG)*xi + (YA-YG)*(1-xi)$
x_BC(xi) := (XC-XG)*xi + (XB-XG)*(1-xi)$
y_BC(xi) := (YC-YG)*xi + (YB-YG)*(1-xi)$
x_CD(xi) := (XD-XG)*xi + (XC-XG)*(1-xi)$
y_CD(xi) := (YD-YG)*xi + (YC-YG)*(1-xi)$

calcolo aree

Area calculation by integration along the section

area :  integrate(t * l_AB ,xi,0,1)
      + integrate(t * l_BC ,xi,0,1)
      + integrate(t * l_CD ,xi,0,1);