version 0.6.0
Loading...
Searching...
No Matches
mod_shape_basic::t_shape_torus Type Reference

Torus shape around Z-axis (3D only)

+ Inheritance diagram for mod_shape_basic::t_shape_torus:

Public Member Functions

procedure initialize (shape)
 Initialize the shape.
 
procedure copy (shape, copy)
 Copy the shape.
 
procedure is_inside (shape, point)
 Check if a point lies inside the shape.
 
procedure get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in a shape.
 
procedure get_distance (shape, point, distance, direction)
 Compute the distance and the direction from a point to the shape.
 
procedure ray_trace (shape, ray, has_normal, intersection_list)
 Compute the intersection between the torus and a ray.
 
- Public Member Functions inherited from type_shape::t_shape
procedure(abs_initialize_shape), deferred initialize (shape)
 Initialize the shape.
 
procedure(abs_copy_shape), deferred copy (shape, copy)
 Copy the shape.
 
procedure(abs_shape_is_inside), deferred is_inside (shape, point)
 Check if a point lies inside the shape.
 
procedure(abs_shape_get_samples_inside), deferred get_samples_inside (shape, i, j, k, n, n_samples, samples)
 Check if a given number of point lies in a shape.
 
procedure(abs_shape_get_distance), deferred get_distance (shape, point, distance, direction)
 Compute the distance and the direction from a point to the shape.
 
procedure(abs_shape_ray_trace), deferred ray_trace (shape, ray, has_normal, intersection_list)
 Compute the intersection between the shape and a ray.
 

Public Attributes

double precision, dimension(3) center = 0d0
 Origin of the torus.
 
double precision, dimension(3) axis = 0d0
 Axis of the torus.
 
double precision big_radius = 0d0
 Big radius of the torus.
 
double precision small_radius = 0d0
 Small radius of the torus.
 
double precision, dimension(3, 2) bounding_box
 Aligned-axis bounding-box (in the frame of the shape)
 
- Public Attributes inherited from type_shape::t_shape
integer dimension = 2
 Dimension of the shape.
 
type(t_cg_transformationtransformation
 Transformation matrix.
 
logical is_reversed = .false.
 Swap interior/exterior sides of the shape.
 

Member Function/Subroutine Documentation

◆ copy()

procedure mod_shape_basic::t_shape_torus::copy ( class(t_shape_torus), intent(in) shape,
class(t_shape), allocatable copy )
Parameters
[in]shapetorus shape
[out]copycopied torus

◆ get_distance()

procedure mod_shape_basic::t_shape_torus::get_distance ( class(t_shape_torus), 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 torus, the distance is negative and the direction points to the closest point on the torus. If the point lies outiside the torus, the distance is positive and the direction points in the opposite direction to the closest point on the torus.

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

◆ get_samples_inside()

procedure mod_shape_basic::t_shape_torus::get_samples_inside ( class(t_shape_torus), 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]shapetorus shape
[in]i,j,kcoordinates of the cell
[in]nvalue to put where the sample is inside the torus
[in]n_samplessampling level (see description)
[in,out]samplesarray of the (2*n_samples+1)^d samples

◆ initialize()

procedure mod_shape_basic::t_shape_torus::initialize ( class(t_shape_torus), intent(inout) shape)
Parameters
[in,out]shapetorus shape

◆ is_inside()

procedure mod_shape_basic::t_shape_torus::is_inside ( class(t_shape_torus), intent(in) shape,
double precision, dimension(3), intent(in) point )
Parameters
[in]shapetorus shape
[in]pointany point

◆ ray_trace()

procedure mod_shape_basic::t_shape_torus::ray_trace ( class(t_shape_torus), intent(in) shape,
type(t_ray), intent(in) ray,
logical, intent(in) has_normal,
type(t_intersection_list), intent(inout) intersection_list )
Parameters
[in]shapetorus shape
[in]rayray to intersect the torus
[in]has_normallist of intersections between the ray and the torus
[in,out]intersection_listlist of intersections between the ray and the torus

The documentation for this type was generated from the following file: