tem_intersec_ray_point Subroutine

public subroutine tem_intersec_ray_point(point, line, intersects, intersection)

This subroutine checks whether a line intersects with a point

Arguments

Type IntentOptional Attributes Name
real(kind=rk), dimension(3) :: point
type(tem_line) :: line
logical :: intersects
type(tem_intersec) :: intersection

Called by

proc~~tem_intersec_ray_point~~CalledByGraph proc~tem_intersec_ray_point tem_intersec_ray_point proc~exit_element exit_element proc~exit_element->proc~tem_intersec_ray_point

Source Code

  subroutine tem_intersec_ray_point( point, line, intersects, intersection )
    ! ---------------------------------------------------------------------------
    type(tem_line) :: line
    real(kind=rk),dimension(3) :: point
    type(tem_intersec) :: intersection
    logical :: intersects
    ! ---------------------------------------------------------------------------
    real(kind=rk),dimension(3) :: test_lambda
    ! ---------------------------------------------------------------------------

    test_lambda = ( point - line%coordStart ) / line%direction
    if ( ( test_lambda(1) .feq. test_lambda(2) ) .and.                         &
      & ( test_lambda(1) .feq. test_lambda(3) ) ) then
      intersection%lambda = test_lambda(1)
      intersects = .true.
      intersection%coord = point
    end if

  end subroutine tem_intersec_ray_point