evaluate_sphere Function

private pure elemental function evaluate_sphere(this, pos) result(res)

Evaluation function for Sphere SDF.

Type Bound

sphere

Arguments

Type IntentOptional Attributes Name
class(sphere), intent(in) :: this
type(vector), intent(in) :: pos

vector position to evaluate SDF at

Return Value real(kind=wp)


Source Code

    pure elemental function evaluate_sphere(this, pos) result(res)
        !! Evaluation function for Sphere SDF.

        class(sphere), intent(in) :: this
        !> vector position to evaluate SDF at
        type(vector),  intent(in) :: pos

        real(kind=wp) :: res

        type(vector) :: p

        p = pos .dot. this%transform
        res = sqrt(p%x**2+p%y**2+p%z**2) - this%radius

    end function evaluate_sphere