This module defines the signed distance function (SDF) abstract type, sdf_base type, and model type. The SDF abstract type contains the optical properties of an SDF (mus, mua, kappa, albedo, hgg, g2,and n), as well as a transform (4x4 matrix), and the layer ID code of the SDF. The SDF abstract type also provides an abstract interface (evaluate) which each inheriting function must implement. This evaluate function is the heart of the SDF implementation. Each individual evaluate is the direct implementation of that SDF, e.g. that function defines the mathematical SDF. For more information on SDFs, check out Inigo Quilez's website from which most of the below SDFs and transforms have been taken. API based upon here
Initalise the model type.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(sdf), | intent(in) | :: | array(:) |
Array of SDFs |
||
procedure(op) | :: | func |
Operator to apply to SDF. |
|||
real(kind=wp), | intent(in), | optional | :: | kopt |
Parameter used in modifier |
Render the SDFs onto a voxel grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(sdf), | intent(in) | :: | cnt(:) | |||
type(vector), | intent(in) | :: | extent | |||
integer, | intent(in) | :: | samples(3) | |||
type(settings_t), | intent(in) | :: | state |
Render the SDF Wrapper around the render function to allow ease of use
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(sdf), | intent(in) | :: | cnt(:) | |||
type(settings_t), | intent(in) | :: | state |
Abstract function used as the base for SDF operators (union, subtraction etc)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | d1 | |||
real(kind=wp), | intent(in) | :: | d2 | |||
real(kind=wp), | intent(in) | :: | k |
Abstract function used as base for displacement function
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(vector), | intent(in) | :: | pos |
vector position of photon packet. |
Model type. Allows the collection of multiple SDF into one model. Used to apply modifiers.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(sdf), | public, | allocatable | :: | array(:) |
Array of SDFs in the model |
||
procedure(op), | public, | nopass, pointer | :: | func |
SDF modifier function |
||
real(kind=wp), | public | :: | k |
Parameter that may be used in modifer function. |
|||
integer, | public | :: | layer |
Layer ID of SDF |
|||
type(opticalProp_t), | public | :: | optProps |
Optical property of the SDF |
|||
real(kind=wp), | public | :: | transform(4,4) |
Transform to apply to SDF. |
private function model_init (array, func, kopt) | Initalise the model type. |
procedure, public :: evaluate => eval_model |
Container type that allows the use of arrays of different SDF shapes
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | layer |
Layer ID of SDF |
|||
type(opticalProp_t), | public | :: | optProps |
Optical property of the SDF |
|||
real(kind=wp), | public | :: | transform(4,4) |
Transform to apply to SDF. |
|||
class(sdf_base), | public, | allocatable | :: | value |
Container for any SDF that inherits from SDF_base |
private function sdf_new (rhs) | sdf initializer |
generic, public :: assignment(=) => sdf_assign | |
procedure, public :: evaluate => sdf_evaluate | |
procedure, public :: getAlbedo | |
procedure, public :: getG2 => getg2 | |
procedure, public :: getKappa | |
procedure, public :: getMua | |
procedure, public :: getN | |
procedure, public :: gethgg | |
procedure, private :: sdf_assign |
Abstract base type from which all SDF inherit from.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | layer |
Layer ID of SDF |
|||
type(opticalProp_t), | public | :: | optProps |
Optical property of the SDF |
|||
real(kind=wp), | public | :: | transform(4,4) |
Transform to apply to SDF. |
procedure(evalInterface), public, deferred :: evaluate |
Return albedo for the current SDF.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sdf) | :: | this |
Return for the current SDF
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sdf) | :: | this |
Return for the current SDF.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sdf) | :: | this |
Return refractive index for the current SDF.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sdf) | :: | this |
Return factor for the current SDF.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sdf) | :: | this |
Return g-factor for the current SDF.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sdf) | :: | this |
Render the SDFs onto a voxel grid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(sdf), | intent(in) | :: | cnt(:) | |||
type(vector), | intent(in) | :: | extent | |||
integer, | intent(in) | :: | samples(3) | |||
type(settings_t), | intent(in) | :: | state |
Render the SDF Wrapper around the render function to allow ease of use
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(sdf), | intent(in) | :: | cnt(:) | |||
type(settings_t), | intent(in) | :: | state |