Compute AABB extents (minimum and maximum bounding box) from facets list.
Facets' metrix must be already computed.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(facet_object), | intent(in) | :: | facet(:) | Facets list. |
||
| type(vector_R8P), | intent(inout) | :: | bmin | Minimum point of AABB. |
||
| type(vector_R8P), | intent(inout) | :: | bmax | Maximum point of AABB. |
pure subroutine compute_bb_from_facets(facet, bmin, bmax)
!< Compute AABB extents (minimum and maximum bounding box) from facets list.
!<
!< @note Facets' metrix must be already computed.
type(facet_object), intent(in) :: facet(:) !< Facets list.
type(vector_R8P), intent(inout) :: bmin !< Minimum point of AABB.
type(vector_R8P), intent(inout) :: bmax !< Maximum point of AABB.
real(R8P) :: toll(3) !< Small tollerance on AABB inclusion.
toll(1) = (maxval(facet(:)%bb(2)%x) - minval(facet(:)%bb(1)%x)) / 100._R8P
toll(2) = (maxval(facet(:)%bb(2)%y) - minval(facet(:)%bb(1)%y)) / 100._R8P
toll(3) = (maxval(facet(:)%bb(2)%z) - minval(facet(:)%bb(1)%z)) / 100._R8P
bmin%x = minval(facet(:)%bb(1)%x) - toll(1)
bmin%y = minval(facet(:)%bb(1)%y) - toll(2)
bmin%z = minval(facet(:)%bb(1)%z) - toll(3)
bmax%x = maxval(facet(:)%bb(2)%x) + toll(1)
bmax%y = maxval(facet(:)%bb(2)%y) + toll(2)
bmax%z = maxval(facet(:)%bb(2)%z) + toll(3)
endsubroutine compute_bb_from_facets