Evaluation function for Sphere SDF.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sphere), | intent(in) | :: | this | |||
type(vector), | intent(in) | :: | pos |
vector position to evaluate SDF at |
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