Circle/sphere shape. More...
Inheritance diagram for mod_shape_basic::t_shape_circle: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 circle/sphere. | |
| procedure | get_samples_inside (shape, i, j, k, n, n_samples, samples) |
| Check if a given number of point lies in the circle/sphere. | |
| procedure | get_distance (shape, point, distance, direction) |
| Compute the distance and the direction from a point to the circle/sphere. | |
| procedure | ray_trace (shape, ray, has_normal, intersection_list) |
| Compute the intersection between the circle/sphere 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 | radius = 0d0 |
| Radius of the circle. | |
| double precision, dimension(3) | center = 0d0 |
| Center of the circle. | |
Public Attributes inherited from type_shape::t_shape | |
| integer | dimension = 2 |
| Dimension of the shape. | |
| type(t_cg_transformation) | transformation |
| Transformation matrix. | |
| logical | is_reversed = .false. |
| Swap interior/exterior sides of the shape. | |
Circle/sphere shape.
| procedure mod_shape_basic::t_shape_circle::copy | ( | class(t_shape_circle), intent(in) | shape, |
| class(t_shape), allocatable | copy ) |
Copy the shape.
| [in] | shape | circle/sphere shape |
| [out] | copy | copied circle/sphere |
| procedure mod_shape_basic::t_shape_circle::get_distance | ( | class(t_shape_circle), intent(in) | shape, |
| double precision, dimension(3), intent(in) | point, | ||
| double precision, intent(out) | distance, | ||
| double precision, dimension(3), intent(out) | direction ) |
Compute the distance and the direction from a point to the circle/sphere.
If the point lies inside the circle/sphere, the distance is negative and the direction points to the closest point on the circle/sphere. If the point lies outiside the circle/sphere, the distance is positive and the direction points in the opposite direction to the closest point on the circle/sphere.
| [in] | shape | circle/sphere shape |
| [in] | point | any point |
| [out] | distance | signed closest distance from the point to the circle/sphere |
| [out] | direction | signed direction from the point to the closest point on the circle/sphere |
| procedure mod_shape_basic::t_shape_circle::get_samples_inside | ( | class(t_shape_circle), 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 ) |
Check if a given number of point lies in the circle/sphere.
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 !! ┏━━━━━━━┓ ×━━━×━━━× ×━×━×━×━× !! ┃ ┃ ┃ ┃ × × × × × !! ┃ × ┃ × × × × × × × × ... !! ┃ ┃ ┃ ┃ × × × × × !! ┗━━━━━━━┛ ×━━━×━━━× ×━×━×━×━× !!
| [in,out] | shape | circle/sphere shape |
| [in] | i,j,k | coordinates of the cell |
| [in] | n | value to put where the sample is inside the circle/sphere |
| [in] | n_samples | sampling level (see description) |
| [in,out] | samples | array of the (2*n_samples+1)^d samples |
| procedure mod_shape_basic::t_shape_circle::initialize | ( | class(t_shape_circle), intent(inout) | shape | ) |
Initialize the shape.
| [in,out] | shape | circle/sphere shape |
| procedure mod_shape_basic::t_shape_circle::is_inside | ( | class(t_shape_circle), intent(in) | shape, |
| double precision, dimension(3), intent(in) | point ) |
Check if a point lies inside the circle/sphere.
| [in] | shape | circle/sphere shape |
| [in] | point | any point |
| procedure mod_shape_basic::t_shape_circle::ray_trace | ( | class(t_shape_circle), intent(in) | shape, |
| type(t_ray), intent(in) | ray, | ||
| logical, intent(in) | has_normal, | ||
| type(t_intersection_list), intent(inout) | intersection_list ) |
Compute the intersection between the circle/sphere and a ray.
| [in] | shape | circle/sphere shape |
| [in] | ray | ray to intersect the circle/sphere |
| [in] | has_normal | list of intersections between the ray and the circle/sphere |
| [in,out] | intersection_list | list of intersections between the ray and the circle/sphere |