|
pure subroutine | mod_cg2_polygon::cg2_initialize_polygon (polygon, n) |
| Initialize the polygon structure. More...
|
|
elemental subroutine | mod_cg2_polygon::cg2_finalize_polygon (polygon) |
| Finalize the polygon structure. More...
|
|
double precision elemental function | mod_cg2_polygon::cg2_polygon_volume (polygon) |
| Compute the area of a polygon. More...
|
|
pure subroutine | mod_cg2_polygon::cg2_polygon_centroid (polygon, centroid, volume) |
| Compute the centroid of a polygon. More...
|
|
integer pure function | mod_cg2_polygon::cg2_polygon_winding_number (polygon, point) |
| Compute the winding number of a point in a polygon. More...
|
|
integer pure function | mod_cg2_polygon::cg2_polygon_winding_number_with_boundary (polygon, point) |
| Compute the winding number of a point in a polygon including its boundary. More...
|
|
pure subroutine | mod_cg2_polygon::cg2_split_quad_in_triangles (quad, triangle1, triangle2) |
| Split a quadrilateral in two triangles. More...
|
|
pure subroutine | mod_cg2_polygon::cg2_copy_polygon (original, copy) |
| Make a copy of a polygon. More...
|
|
elemental subroutine | mod_cg2_polygon::cg2_move_alloc_polygon (polygon1, polygon2) |
| Move the allocation of a given polygon to another polygon. More...
|
|
subroutine | mod_cg2_polygon::cg2_polygon_write_vtk_file (polygon, filename) |
| Print a polygon into a VTK file for debug purpose. More...
|
|
pure subroutine mod_cg2_polygon::cg2_polygon_centroid |
( |
type(t_polygon), intent(in) |
polygon, |
|
|
double precision, dimension(2), intent(out) |
centroid, |
|
|
double precision, intent(out), optional |
volume |
|
) |
| |
May also output the volume of a polygon
The centroid \(x_c(\omega)\) of a polygon \(\omega\) is given by
\[
x_c(\omega) = x_0 + \dfrac{1}{6|\omega|}\sum_{i=1}^{n}[(x_i - x_0)\times(x_{i+1}-x_0)]((x_i - x_0) + (x_{i+1} - x_0))
\]
Where \( x_0 \) is any point of the real plane
- Parameters
-
[in] | polygon | Any polygon |
[out] | centroid | Centroid of the polygon |
[out] | volume | Volume of the polygon |
pure subroutine mod_cg2_polygon::cg2_split_quad_in_triangles |
( |
type(t_polygon), intent(in) |
quad, |
|
|
type(t_polygon), intent(out) |
triangle1, |
|
|
type(t_polygon), intent(out) |
triangle2 |
|
) |
| |
Check the concavity. Two cases:
|
Case 1: | Case 2:
|
1 4 | 4 3
+----------+ | +----------+
`. / | `. /
`. / | `. /
`. \3 | `. \2
`. \ | `. \
`.\ | `.\
`\ | `\
2 | 1
|
Generate: | Generate:
- {1, 3, 4} | - {4, 2, 3}
- {1, 2, 3} | - {4, 1, 2}
- Parameters
-
[in] | quad | Quadrilateral |
[out] | triangle1,triangle2 | quad split in two triangles |