Evaluation function for Triprisim SDF.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(triprism), | intent(in) | :: | this | |||
type(vector), | intent(in) | :: | pos |
vector position to evaluate SDF at |
pure elemental function evaluate_triprism(this, pos) result(res) !! Evaluation function for Triprisim SDF. class(triprism), intent(in) :: this !> vector position to evaluate SDF at type(vector), intent(IN) :: pos real(kind=wp) :: res type(vector) :: q, p p = pos .dot. this%transform q = abs(p) res = max(q%z - this%h2, max(q%x*.866025_wp + p%y*.5_wp, -p%y) - this%h1*.5_wp) end function evaluate_triprism