eval_bend Function

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

Evaluation function for Bend modifier.

Type Bound

bend

Arguments

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

Position to evaluate the modifier at

Return Value real(kind=wp)


Source Code

    pure elemental function eval_bend(this, pos) result(res)
        !! Evaluation function for Bend modifier.

        class(bend),  intent(in) :: this
        !> Position to evaluate the modifier at
        type(vector), intent(IN) :: pos
        real(kind=wp) :: res

        real(kind=wp) :: c, s, x2, y2, z2

        c = cos(this%k * pos%x)
        s = sin(this%k * pos%x)
        x2 = c * pos%x - s * pos%y
        y2 = s * pos%x + c * pos%y
        z2 = pos%z

        res = this%prim%evaluate(vector(x2, y2, z2))

    end function eval_bend