Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(vector), | intent(in) | :: | n |
Normal to the plane |
||
type(vector), | intent(in) | :: | p0 |
a point on the plane |
||
type(vector), | intent(in) | :: | l0 |
origin of the ray |
||
type(vector), | intent(in) | :: | l |
direction vector of the ray |
||
real(kind=wp), | intent(inout) | :: | t |
Distance from l0 to the intersection point |
logical function intersectPlane(n, p0, l0, l, t) ! !> Normal to the plane type(vector), intent(in) :: n !> a point on the plane type(vector), intent(in) :: p0 !> direction vector of the ray type(vector), intent(in) :: l !> origin of the ray type(vector), intent(in) :: l0 !> Distance from l0 to the intersection point real(kind=wp), intent(inout) :: t real(kind=wp) :: denom type(vector) :: p0l0 intersectPlane = .false. denom = n .dot. l if(denom > 1e-6_wp)then p0l0 = p0 - l0 t = p0l0 .dot. n t = t / denom if(t >= 0._wp)intersectPlane=.true. end if end function intersectPlane