version 0.6.0
Surface mesh shape

Data Types

type  mod_shape_surface_mesh::t_distance_list
 Distance list Store distances. Act as a z-buffer. More...
 
type  mod_shape_surface_mesh::t_shape_surface_mesh
 Surface mesh shape. More...
 

Functions/Subroutines

subroutine mod_shape_surface_mesh::copy_shape_surface_mesh (shape, copy)
 Copy the surface mesh. More...
 
subroutine mod_shape_surface_mesh::shape_surface_mesh_get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in a surface mesh. More...
 
pure subroutine mod_shape_surface_mesh::shape_surface_mesh_get_distance (shape, point, distance, direction)
 Compute the signed distance and the signed direction from a point to the surface mesh. More...
 

Detailed Description

Function/Subroutine Documentation

◆ copy_shape_surface_mesh()

subroutine mod_shape_surface_mesh::copy_shape_surface_mesh ( class(t_shape_surface_mesh), intent(in)  shape,
class(t_shape), allocatable  copy 
)
Parameters
[in]shapesurface mesh shape
[out]copycopied surface mesh shape

◆ shape_surface_mesh_get_distance()

pure subroutine mod_shape_surface_mesh::shape_surface_mesh_get_distance ( class(t_shape_surface_mesh), intent(in)  shape,
double precision, dimension(3), intent(in)  point,
double precision, intent(out)  distance,
double precision, dimension(3), intent(out)  direction 
)

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

Parameters
[in]shapesurface mesh shape
[in]pointany point
[out]distancesigned closest distance from the point to the surface mesh
[out]directionsigned direction from the point to the closest point on the surface mesh

◆ shape_surface_mesh_get_samples_inside()

subroutine mod_shape_surface_mesh::shape_surface_mesh_get_samples_inside ( class(t_shape_surface_mesh), 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 
)

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]shapesurface mesh shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the surface mesh
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_sammples+1)^d samples