4 #ifdef INCLUDE_TEST_DRIVER
14 d2r = acos(-1.0)/180.0d0
16 v(1,1) = 10.0d0*d2r; v(2,1) = 20.0d0*d2r
17 v(1,2) = 15.0d0*d2r; v(2,2) = 30.0d0*d2r
18 v(1,3) = 17.7d0*d2r; v(2,3) = 25.0d0*d2r
19 v(1,4) = 20.0d0*d2r; v(2,4) = 20.0d0*d2r
25 p(1) = 17.7d0*d2r; p(2) = 25.000000001d0*d2r
29 print*,
'inside ', co_gc
31 print*,
'outside ', co_gc
51 REAL*8,
INTENT(IN) :: v(2,n), p(2)
52 INTEGER,
INTENT(IN) :: n
53 INTEGER,
INTENT(OUT) :: co_gc
56 REAL*8 cp_z(n), cos_d2c, eps
61 eps = 0.000000000000001d0
64 cos_d2c = sin(p(1))*sin(v(1,i)) + cos(p(1))*cos(v(1,i))*cos(v(2,i)-p(2))
65 v_xy(1,i) = (cos(v(1,i))*sin(v(2,i)-p(2)))/cos_d2c
66 v_xy(2,i) = (cos(p(1))*sin(v(1,i))-sin(p(1))*cos(v(1,i))*cos(v(2,i)-p(2)))/cos_d2c
72 cp_z(i) = v_xy(1,i)*v_xy(2,ip1)-v_xy(2,i)*v_xy(1,ip1)
73 IF (abs(cp_z(i)) < eps) co_gc = i
78 IF (cp_z(i)*cp_z(ip1) .LT. -eps)
THEN
LOGICAL function enclosure_cnvx(v, n, p, co_gc)
Test whether a given point 'p' is inside a convex spherical polygon defined with a series of 'n' vert...