cone_init Function

private function cone_init(a, b, ra, rb, optProp, layer, transform) result(out)

Initalising function for Capped Cone SDF.

Arguments

Type IntentOptional Attributes Name
type(vector), intent(in) :: a

Centre of base of Cone

type(vector), intent(in) :: b

Tip of cone

real(kind=wp), intent(in) :: ra

Radius of Cones base

real(kind=wp), intent(in) :: rb

Radius of Cones tip. For rb = 0.0 get normal uncapped cone.

type(opticalProp_t), intent(in) :: optProp

Optical properties of the SDF

integer, intent(in) :: layer

ID number of sdf

real(kind=wp), intent(in), optional :: transform(4,4)

Optional transform to apply to SDF

Return Value type(cone)


Source Code

    function cone_init(a, b, ra, rb, optProp, layer, transform) result(out)
        !! Initalising function for Capped Cone SDF.

        type(cone) :: out
        
        !> Centre of base of Cone
        type(vector),             intent(IN) :: a
        !> Tip of cone
        type(vector),             intent(IN) :: b
        !> Radius of Cones base
        real(kind=wp),            intent(IN) :: ra
        !> Radius of Cones tip. For rb = 0.0 get normal uncapped cone.
        real(kind=wp),            intent(in) :: rb
        !> ID number of sdf
        integer,                  intent(IN) :: layer
        !> Optional transform to apply to SDF
        real(kind=wp),  optional, intent(IN) :: transform(4, 4)
        !> Optical properties of the SDF
        type(opticalProp_t),      intent(in) :: optProp

        real(kind=wp) :: t(4, 4)

        if(present(transform))then
            t = transform
        else
            t = identity()
        end if

        out%a = a
        out%b = b
        out%ra = ra
        out%rb = rb
        out%layer = layer
        out%transform = t
        out%optProps = optProp

    end function cone_init