Return closest point on (or in) AABB from point reference.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(aabb_object), | intent(in) | :: | self | AABB. |
||
| type(vector_R8P), | intent(in) | :: | point | Point reference. |
Closest point on (on in) aabb to point.
pure function closest_point(self, point) result(closest)
!< Return closest point on (or in) AABB from point reference.
class(aabb_object), intent(in) :: self !< AABB.
type(vector_R8P), intent(in) :: point !< Point reference.
type(vector_R8P) :: closest !< Closest point on (on in) aabb to point.
closest = point
closest%x = max(closest%x, self%bmin%x) ; closest%x = min(closest%x, self%bmax%x)
closest%y = max(closest%y, self%bmin%y) ; closest%y = min(closest%y, self%bmax%y)
closest%z = max(closest%z, self%bmin%z) ; closest%z = min(closest%z, self%bmax%z)
endfunction closest_point