FORCES
FORtran lib for Comp. Env. Sys.
|
Center of mass of polygon. More...
Public Member Functions | |
real(sp) function, dimension(2) | center_of_mass_sp (coord) |
Center of mass of polygon. | |
real(dp) function, dimension(2) | center_of_mass_dp (coord) |
Center of mass of polygon. | |
Center of mass of polygon.
Function for computing the center of mass of a polygon (2D, convex or not).
\[ A = \sum_{i}(x_{i}y_{i+1}-x_{i+1}y_{i}) \]
\[ x_s = \frac{1}{6A} \sum_i(x_i+x_{i+1})(x_iy_{i+1}-x_{i+1}y_i) \]
\[ y_s = \frac{1}{6A} \sum_i(y_i+y_{i+1})(x_iy_{i+1}-x_{i+1}y_i) \]
Example
See also example in test directory
Literature
[in] | coord | coordinates of polygon in question |
Definition at line 39 of file mo_poly.f90.
real(dp) function, dimension(2) mo_poly::center_of_mass::center_of_mass_dp | ( | real(dp), dimension(:,:), intent(in) | coord | ) |
Center of mass of polygon.
Function for computing the center of mass of a polygon (2D, convex or not).
\[ A = \sum_{i}(x_{i}y_{i+1}-x_{i+1}y_{i}) \]
\[ x_s = \frac{1}{6A} \sum_i(x_i+x_{i+1})(x_iy_{i+1}-x_{i+1}y_i) \]
\[ y_s = \frac{1}{6A} \sum_i(y_i+y_{i+1})(x_iy_{i+1}-x_{i+1}y_i) \]
Example
See also example in test directory
Literature
[in] | coord | coordinates of polygon in question |
Definition at line 543 of file mo_poly.f90.
References mo_poly::areapoly_dp().
real(sp) function, dimension(2) mo_poly::center_of_mass::center_of_mass_sp | ( | real(sp), dimension(:,:), intent(in) | coord | ) |
Center of mass of polygon.
Function for computing the center of mass of a polygon (2D, convex or not).
\[ A = \sum_{i}(x_{i}y_{i+1}-x_{i+1}y_{i}) \]
\[ x_s = \frac{1}{6A} \sum_i(x_i+x_{i+1})(x_iy_{i+1}-x_{i+1}y_i) \]
\[ y_s = \frac{1}{6A} \sum_i(y_i+y_{i+1})(x_iy_{i+1}-x_{i+1}y_i) \]
Example
See also example in test directory
Literature
[in] | coord | coordinates of polygon in question |
Definition at line 168 of file mo_poly.f90.
References mo_poly::areapoly_sp().