Indicator function for determining if a point on a plane is within the plane boundary
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(BoundedPlane), | intent(in) | :: | bplane | Plane with boundary |
||
real(kind=Float64), | intent(in), | dimension(3) | :: | p | Point on plane |
function in_boundary(bplane, p) result(in_b)
!+ Indicator function for determining if a point on a plane is within the plane boundary
type(BoundedPlane), intent(in) :: bplane
!+ Plane with boundary
real(Float64), dimension(3), intent(in) :: p
!+ Point on plane
logical :: in_b
real(Float64), dimension(3) :: pp
real(Float64) :: hh, hw
hh = bplane%hh
hw = bplane%hw
pp = matmul(bplane%inv_basis, p - bplane%origin)
in_b = .False.
SELECT CASE (bplane%shape)
CASE (1) !Rectangular boundary
if((abs(pp(1)).le.hw).and. &
(abs(pp(2)).le.hh)) then
in_b = .True.
endif
CASE (2) !Circular/Ellipsoidal boundary
if(((hh*pp(1))**2 + (hw*pp(2))**2).le.((hh*hw)**2)) then
in_b = .True.
endif
CASE DEFAULT
if(inputs%verbose.ge.0) then
write(*,'("IN_BOUNDARY: Unknown boundary shape: ",i2)') bplane%shape
endif
stop
END SELECT
end function in_boundary