line_plane_intersect Subroutine

public subroutine line_plane_intersect(l0, l, p0, n, p, t)

Calculates the intersection of a line and a plane

Arguments

Type IntentOptional AttributesName
real(kind=Float64), intent(in), dimension(3):: l0

Point on line

real(kind=Float64), intent(in), dimension(3):: l

Ray of line

real(kind=Float64), intent(in), dimension(3):: p0

Point on plane

real(kind=Float64), intent(in), dimension(3):: n

Normal vector of plane

real(kind=Float64), intent(out), dimension(3):: p

Line-plane intersect point

real(kind=Float64), intent(out) :: t

"time" to intersect


Called by

proc~~line_plane_intersect~~CalledByGraph proc~line_plane_intersect line_plane_intersect proc~hit_npa_detector hit_npa_detector proc~hit_npa_detector->proc~line_plane_intersect proc~gyro_range gyro_range proc~gyro_range->proc~line_plane_intersect proc~pnpa_f pnpa_f proc~pnpa_f->proc~hit_npa_detector proc~npa_gyro_range npa_gyro_range proc~pnpa_f->proc~npa_gyro_range proc~npa_gyro_range->proc~gyro_range proc~pnpa_mc pnpa_mc proc~pnpa_mc->proc~hit_npa_detector proc~pnpa_mc->proc~npa_gyro_range proc~make_diagnostic_grids make_diagnostic_grids proc~make_diagnostic_grids->proc~hit_npa_detector proc~npa_f npa_f proc~npa_f->proc~hit_npa_detector proc~npa_f->proc~npa_gyro_range proc~npa_mc npa_mc proc~npa_mc->proc~hit_npa_detector proc~npa_mc->proc~npa_gyro_range proc~npa_weights npa_weights proc~npa_weights->proc~hit_npa_detector program~fidasim fidasim program~fidasim->proc~pnpa_f program~fidasim->proc~pnpa_mc program~fidasim->proc~make_diagnostic_grids program~fidasim->proc~npa_f program~fidasim->proc~npa_mc program~fidasim->proc~npa_weights

Contents

Source Code


Source Code

subroutine line_plane_intersect(l0, l, p0, n, p, t)
    !+ Calculates the intersection of a line and a plane
    real(Float64), dimension(3), intent(in)  :: l0
        !+ Point on line
    real(Float64), dimension(3), intent(in)  :: l
        !+ Ray of line
    real(Float64), dimension(3), intent(in)  :: p0
        !+ Point on plane
    real(Float64), dimension(3), intent(in)  :: n
        !+ Normal vector of plane
    real(Float64), dimension(3), intent(out) :: p
        !+ Line-plane intersect point
    real(Float64), intent(out)               :: t
        !+ "time" to intersect

    real(Float64) :: ldotn

    ldotn = dot_product(l, n)
    if(ldotn.eq.0.0)then
        t = 0.0
    else
        t = dot_product(p0 - l0, n)/ldotn
    endif
    p = l0 + t*l

end subroutine line_plane_intersect