This subroutine checks whether a line intersects with a point
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | dimension(3) | :: | point | |||
type(tem_line) | :: | line | ||||
logical | :: | intersects | ||||
type(tem_intersec) | :: | intersection |
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