it's so fun. like to learn a new language.
代码: 全选
subroutine test02 !!!test02>
!
!***********************************************************************
!
!! TEST02 tests CMCIRC.
!
implicit none
!
integer cmcirc
integer in
double precision, parameter :: x0 = 3.0D+00
double precision, parameter :: y0 = 3.0D+00
double precision, parameter :: x1 = 5.0D+00
double precision, parameter :: y1 = 0.0D+00
double precision, parameter :: x2 = 0.0D+00
double precision, parameter :: y2 = 5.0D+00
double precision, parameter :: x3 = -5.0D+00
double precision, parameter :: y3 = 0.0D+00
!
write ( *, '(a)' ) ' '
write ( *, '(a)' ) 'TEST02'
write ( *, '(a)' ) ' CMCIRC determines if a point lies in, on'
write ( *, '(a)' ) ' or outside a circle given by 3 points.'
write ( *, '(a)' ) ' '
write ( *, '(a)' ) ' The points defining the circle:'
write ( *, '(a)' ) ' '
write ( *, '(a,2g14.6)' ) ' X1,Y1 = ', x1, y1
write ( *, '(a,2g14.6)' ) ' X2,Y2 = ', x2, y2
write ( *, '(a,2g14.6)' ) ' X3,Y3 = ', x3, y3
write ( *, '(a)' ) ' '
write ( *, '(a)' ) ' The point to be tested:'
write ( *, '(a)' ) ' '
write ( *, '(a,2g14.6)' ) ' X0,Y0 = ', x0, y0
in = cmcirc ( x0, y0, x1, y1, x2, y2, x3, y3 ) !!!cmcirc
write ( *, '(a)' ) ' '
write ( *, '(a)' ) ' Test results:'
if ( in == 2 ) then !!!check2?>collinear:check1
write ( *, '(a)' ) ' The three points are collinear.' !!!>collinear!!!>
else if ( in == 1 ) then !!!check1?>inside:check0
write ( *, '(a)' ) ' The point is inside the circle.' !!!>inside!!!>
else if ( in == 0 ) then !!!check0?>on:check_1
write ( *, '(a)' ) ' The point is on the circle.' !!!>on!!!>
else if ( in == -1 ) then !!!check_1?outside:return
write ( *, '(a)' ) ' The point is outside the circle.' !!!>outside!!!>
end if !!!check_1!!!check0!!!check1!!!check2
return !!!return
end !!!>test02