version 0.6.0
Loading...
Searching...
No Matches
CSG (Constructive Solid Geometry) shapes

CSG operations: union, intersection and difference More...

Data Types

type  mod_shape_constructive_solid_geometry::t_shape_union
 Union of two shapes. More...
 
type  mod_shape_constructive_solid_geometry::t_shape_intersection
 Intersection of two shapes. More...
 
type  mod_shape_constructive_solid_geometry::t_shape_difference
 Difference of two shapes. More...
 

Functions/Subroutines

recursive subroutine mod_shape_constructive_solid_geometry::initialize_shape_union (shape)
 Initialize the union.
 
recursive subroutine mod_shape_constructive_solid_geometry::copy_shape_union (shape, copy)
 Copy the union.
 
logical pure recursive function mod_shape_constructive_solid_geometry::shape_union_is_inside (shape, point)
 Check if a point lies inside the union.
 
recursive subroutine mod_shape_constructive_solid_geometry::shape_union_get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in an union.
 
pure recursive subroutine mod_shape_constructive_solid_geometry::shape_union_get_distance (shape, point, distance, direction)
 Compute the signed distance and the signed direction from a point to the union.
 
recursive subroutine mod_shape_constructive_solid_geometry::initialize_shape_intersection (shape)
 Initialize the intersection.
 
recursive subroutine mod_shape_constructive_solid_geometry::copy_shape_intersection (shape, copy)
 Copy the intersection.
 
logical pure recursive function mod_shape_constructive_solid_geometry::shape_intersection_is_inside (shape, point)
 Check if a point lies inside the intersection.
 
recursive subroutine mod_shape_constructive_solid_geometry::shape_intersection_get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in an intersection.
 
pure recursive subroutine mod_shape_constructive_solid_geometry::shape_intersection_get_distance (shape, point, distance, direction)
 Compute the signed distance and the signed direction from a point to the intersection.
 
recursive subroutine mod_shape_constructive_solid_geometry::initialize_shape_difference (shape)
 Initialize the difference.
 
recursive subroutine mod_shape_constructive_solid_geometry::copy_shape_difference (shape, copy)
 Copy the difference.
 
logical pure recursive function mod_shape_constructive_solid_geometry::shape_difference_is_inside (shape, point)
 Check if a point lies inside the difference.
 
recursive subroutine mod_shape_constructive_solid_geometry::shape_difference_get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in a difference.
 
pure recursive subroutine mod_shape_constructive_solid_geometry::shape_difference_get_distance (shape, point, distance, direction)
 Compute the signed distance and the signed direction from a point to the difference.
 

Detailed Description

Function/Subroutine Documentation

◆ copy_shape_difference()

recursive subroutine mod_shape_constructive_solid_geometry::copy_shape_difference ( class(t_shape_difference), intent(in) shape,
class(t_shape), allocatable copy )
Parameters
[in]shapedifference shape
[out]copycopied difference

◆ copy_shape_intersection()

recursive subroutine mod_shape_constructive_solid_geometry::copy_shape_intersection ( class(t_shape_intersection), intent(in) shape,
class(t_shape), allocatable copy )
Parameters
[in]shapeintersection shape
[out]copycopied intersection

◆ copy_shape_union()

recursive subroutine mod_shape_constructive_solid_geometry::copy_shape_union ( class(t_shape_union), intent(in) shape,
class(t_shape), allocatable copy )
Parameters
[in]shapeunion shape
[out]copycopied union

◆ initialize_shape_difference()

recursive subroutine mod_shape_constructive_solid_geometry::initialize_shape_difference ( class(t_shape_difference), intent(inout) shape)
Parameters
[in,out]shapedifference shape

◆ initialize_shape_intersection()

recursive subroutine mod_shape_constructive_solid_geometry::initialize_shape_intersection ( class(t_shape_intersection), intent(inout) shape)
Parameters
[in,out]shapeintersection shape

◆ initialize_shape_union()

recursive subroutine mod_shape_constructive_solid_geometry::initialize_shape_union ( class(t_shape_union), intent(inout) shape)
Parameters
[in,out]shapeunion shape

◆ shape_difference_get_distance()

pure recursive subroutine mod_shape_constructive_solid_geometry::shape_difference_get_distance ( class(t_shape_difference), 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 difference, the distance is negative and the direction points to the closest point on the difference. If the point lies outiside the difference, the distance is positive and the direction points in the opposite direction to the closest point on the difference.

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

◆ shape_difference_get_samples_inside()

recursive subroutine mod_shape_constructive_solid_geometry::shape_difference_get_samples_inside ( class(t_shape_difference), 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]shapedifference shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the difference
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_sammples+1)^d samples

◆ shape_difference_is_inside()

logical pure recursive function mod_shape_constructive_solid_geometry::shape_difference_is_inside ( class(t_shape_difference), intent(in) shape,
double precision, dimension(3), intent(in) point )
Parameters
[in]shapedifference shape
[in]pointany point

◆ shape_intersection_get_distance()

pure recursive subroutine mod_shape_constructive_solid_geometry::shape_intersection_get_distance ( class(t_shape_intersection), 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 intersection, the distance is negative and the direction points to the closest point on the intersection. If the point lies outiside the intersection, the distance is positive and the direction points in the opposite direction to the closest point on the intersection.

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

◆ shape_intersection_get_samples_inside()

recursive subroutine mod_shape_constructive_solid_geometry::shape_intersection_get_samples_inside ( class(t_shape_intersection), 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]shapeintersection shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the intersection
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_sammples+1)^d samples

◆ shape_intersection_is_inside()

logical pure recursive function mod_shape_constructive_solid_geometry::shape_intersection_is_inside ( class(t_shape_intersection), intent(in) shape,
double precision, dimension(3), intent(in) point )
Parameters
[in]shapeintersection shape
[in]pointany point

◆ shape_union_get_distance()

pure recursive subroutine mod_shape_constructive_solid_geometry::shape_union_get_distance ( class(t_shape_union), 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 union, the distance is negative and the direction points to the closest point on the union. If the point lies outiside the union, the distance is positive and the direction points in the opposite direction to the closest point on the union.

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

◆ shape_union_get_samples_inside()

recursive subroutine mod_shape_constructive_solid_geometry::shape_union_get_samples_inside ( class(t_shape_union), 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]shapeunion shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the union
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_sammples+1)^d samples

◆ shape_union_is_inside()

logical pure recursive function mod_shape_constructive_solid_geometry::shape_union_is_inside ( class(t_shape_union), intent(in) shape,
double precision, dimension(3), intent(in) point )
Parameters
[in]shapeunion shape
[in]pointany point