0.6.0
Loading...
Searching...
No Matches

Polygonal shape (2D only) More...

Data Types

type  mod_shape_polygon::t_shape_polygon
 Polygon shape. More...
 

Functions/Subroutines

subroutine mod_shape_polygon::initialize_shape_polygon (shape)
 Initialize the polygon shape.
 
subroutine mod_shape_polygon::copy_shape_polygon (shape, copy)
 Copy the polygon.
 
logical pure function mod_shape_polygon::shape_polygon_is_inside (shape, point)
 Check if a point lies inside the polygon.
 
subroutine mod_shape_polygon::shape_polygon_get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in a polygon.
 
pure subroutine mod_shape_polygon::shape_polygon_get_distance (shape, point, distance, direction)
 Compute the signed distance and the signed direction from a point to the polygon.
 

Detailed Description

Polygonal shape (2D only)

Function/Subroutine Documentation

◆ copy_shape_polygon()

subroutine mod_shape_polygon::copy_shape_polygon ( class(t_shape_polygon), intent(in) shape,
class(t_shape), allocatable copy )
private

Copy the polygon.

Parameters
[in]shapepolygon shape
[out]copycopied polygon shape

◆ initialize_shape_polygon()

subroutine mod_shape_polygon::initialize_shape_polygon ( class(t_shape_polygon), intent(inout) shape)

Initialize the polygon shape.

Parameters
[in,out]shapepolygon shape

◆ shape_polygon_get_distance()

pure subroutine mod_shape_polygon::shape_polygon_get_distance ( class(t_shape_polygon), intent(in) shape,
double precision, dimension(3), intent(in) point,
double precision, intent(out) distance,
double precision, dimension(3), intent(out) direction )
private

Compute the signed distance and the signed direction from a point to the polygon.

If the point lies inside the polygon, the distance is negative and the direction points to the closest point on the polygon. If the point lies outiside the polygon, the distance is positive and the direction points in the opposite direction to the closest point on the polygon.

Parameters
[in]shapepolygon shape
[in]pointany point
[out]distancesigned closest distance from the point to the polygon
[out]directionsigned direction from the point to the closest point on the polygon

◆ shape_polygon_get_samples_inside()

subroutine mod_shape_polygon::shape_polygon_get_samples_inside ( class(t_shape_polygon), intent(inout) shape,
integer, intent(in) i,
integer, intent(in) j,
integer, intent(in) k,
integer, intent(in) n,
integer, intent(in) n_samples,
integer, dimension(:,:,:), intent(inout) samples )
private

Check if a given number of point lies in a polygon.

Sample a cell of coordinates (i,j,k) with (2*n_samples+1)^d samples, where d denotes the dimension of the cell. Return a integer array samples containing the value n where the sample is inside the shape.

n_samples is called the sampling level and can take its value in range [0,∞].

Example of sampling for various sampling level:

  !!    n_samples = 0   n_samples = 1   n_samples = 2
  !!      ┏━━━━━━━┓       ×━━━×━━━×       ×━×━×━×━×
  !!      ┃       ┃       ┃       ┃       × × × × ×
  !!      ┃   ×   ┃       ×   ×   ×       × × × × ×    ...
  !!      ┃       ┃       ┃       ┃       × × × × ×
  !!      ┗━━━━━━━┛       ×━━━×━━━×       ×━×━×━×━×
  !! 
Parameters
[in,out]shapepolygon shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the polygon
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_sammples+1)^d samples

◆ shape_polygon_is_inside()

logical pure function mod_shape_polygon::shape_polygon_is_inside ( class(t_shape_polygon), intent(in) shape,
double precision, dimension(3), intent(in) point )
private

Check if a point lies inside the polygon.

Parameters
[in]shapepolygon shape
[in]pointany point