This function checks whether the given point is found inside given cube.
Point is inside the cube only if the point is >= cube origin and < cube max. Point lying on the cube max is not part of the cube
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_point_type) | :: | point | Coordinate of the point to check for intersection. |
|||
type(tem_cube_type) | :: | cube | Cube to intersect with. |
function tem_pointCubeOverlap(point, cube) result(overlap)
! --------------------------------------------------------------------------!
!> Coordinate of the point to check for intersection.
type(tem_point_type) :: point
!> Cube to intersect with.
type(tem_cube_type) :: cube
logical :: overlap !< true if point lies inside else false
! --------------------------------------------------------------------------!
logical :: dirrange(3)
! Check interval in all 3 directions.
dirrange = (point%coord >= cube%origin) &
& .and. (point%coord < cube%origin + cube%extent)
! Overlap depends on all 3 intervals.
overlap = all(dirrange)
end function tem_pointCubeOverlap