tem_pointCubeOverlap Function

public function tem_pointCubeOverlap(point, cube) result(overlap)

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

Arguments

Type IntentOptional Attributes Name
type(tem_point_type) :: point

Coordinate of the point to check for intersection.

type(tem_cube_type) :: cube

Cube to intersect with.

Return Value logical


Contents

Source Code


Source Code

  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%endPnt)

    ! Overlap depends on all 3 intervals.
    overlap = all(dirrange)

  end function tem_pointCubeOverlap