Computational geometry tool to fill a convex polygon with a given volume fraction in a given direction More...
| Functions/Subroutines | |
| pure subroutine, public | mod_cg2_flood_polygon::cg2_flood_polygon (polygon, normal, volume, s0, s1, polygon_full, polygon_empty) | 
| Flood a convex polygon with a given volume fraction in a given direction. | |
| pure integer function | mod_cg2_flood_polygon::cg2_minloc_distance (polygon, pref, normal) | 
| Find the minimum location of the signed distance using Fibonacci search of periodic bimodal function. | |
Computational geometry tool to fill a convex polygon with a given volume fraction in a given direction
| pure subroutine, public mod_cg2_flood_polygon::cg2_flood_polygon | ( | type(t_polygon), intent(in) | polygon, | 
| double precision, dimension(2), intent(in) | normal, | ||
| double precision, intent(in) | volume, | ||
| double precision, dimension(2), intent(out) | s0, | ||
| double precision, dimension(2), intent(out) | s1, | ||
| type(t_polygon), intent(out) | polygon_full, | ||
| type(t_polygon), intent(out) | polygon_empty ) | 
Flood a convex polygon with a given volume fraction in a given direction.
The interface between the full and empty part is supposed to be a line segment.
The input data consists in a convex polygon whose vertices are defined in counterclockwise order, a fill direction (normal) and a volume (volume).
Consider the following 6-point convex polygon and a fill direction (the right arrow):
!! 4 3 !! +--------+-----+ 2 !! / \ fill direction (normal) !! 5 + \ ----> !! `. \ !! `+----------------+ 1 !! 6 !!
The output is composed of the two extreme points of the interface line segment and two polygons (the full part and the empty part). Note that both full and empty parts are convex polygons.
!! 4 s1 3 !! +-----+--+-----+ 2 !! / | \ fill direction (normal) !! 5 + full | empty \ ----> !! `. | \ !! `+---+------------+ 1 !! 6 s0 !!
Requirements:
Note that for better results you can find the empty part if the volume fraction is greater than 0.5.
The present algorithm is an adaptation to convex polygons of the algorithm presented by Breil et al.
References:
| [in] | polygon | Any convex polygon whose points are defined in counterclockwise order | 
| [in] | normal | The direction of flood given by a unit vector | 
| [in] | volume | The required volume fraction of the flooded area | 
| [out] | s0,s1 | The extreme points of the interface line segment | 
| [out] | polygon_full | Part of the polygonfull of fluid | 
| [out] | polygon_empty | Part of the polygonwithout fluid | 
| 
 | private | 
Find the minimum location of the signed distance using Fibonacci search of periodic bimodal function.
References:
Note that this function is different from mod_cg2_line_polygon:cg2_minloc_line_point_signed_distance
| [in] | polygon | Any convex polygon | 
| [in] | pref | Coordinates of the reference point | 
| [in] | normal | Flood direction |