Skip to content

Commit

Permalink
Add a test point located in the middle of the polygon.
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGayno-NOAA committed Dec 2, 2024
1 parent cc477f4 commit cfe59e1
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/orog/ftst_inside_polygon.F90
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,30 @@ program inside_polygon

inside=inside_a_polygon(lon1, lat1, npts, lon2, lat2)

if (.not.inside) stop 14 ! Test point should be inside polygon.
if (.not.inside) stop 14 ! Test point should be inside polygon.

! Test the case when the test point is inside the polygon.
! Here, the test point is exactly in the middle of a square
! polygon. That means the computed angle to each corner
! is 90 degrees.

print*, "Test point 8"

lon1 = 90.5 * D2R ! Test point.
lat1 = 0.5 * D2R

lon2(1) = 90.0 * D2R ! Polygon.
lat2(1) = 0.0 * D2R
lon2(2) = 90.0 * D2R
lat2(2) = 1.0 * D2R
lon2(3) = 91.0 * D2R
lat2(3) = 1.0 * D2R
lon2(4) = 91.0 * D2R
lat2(4) = 0.0 * D2R

inside=inside_a_polygon(lon1, lat1, npts, lon2, lat2)

if (.not.inside) stop 16 ! Test point should be inside polygon.

print*,"OK"
print*,"SUCCSSS"
Expand Down

0 comments on commit cfe59e1

Please sign in to comment.