segment_init Function

private function segment_init(a, b, optProp, layer, transform) result(out)

Initalising function for segment SDF. Note this is a 2D function

Arguments

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

segment start point

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

segment end point

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(segment)


Source Code

    function segment_init(a, b, optProp, layer, transform) result(out)
        !! Initalising function for segment SDF.
        !! Note this is a 2D function

        type(segment) :: out

        !> Optical properties of the SDF
        type(opticalProp_t),     intent(in) :: optProp
        !> segment start point
        type(vector),            intent(IN) :: a
        !> segment end point
        type(vector),            intent(IN) :: b
        !> ID number of sdf
        integer,                 intent(IN) :: layer
        !> Optional transform to apply to SDF
        real(kind=wp), optional, intent(IN) :: transform(4, 4)

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

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

        out%a = a
        out%b = b

        out%layer = layer
        out%transform = t
        
        out%optProps = optProp

    end function segment_init