Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer | :: | n | ||||
type(vector) | :: | p(0:n-1) |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
FUNCTION AreaPolygon (n, p) RESULT(areap)
! PURPOSE OF THIS SUBROUTINE:
! This subroutine calculates the area of a polygon defined by the
! input vectors.
! REFERENCE:
! Graphic Gems.
implicit none
! SUBROUTINE ARGUMENT DEFINITIONS:
integer n
type (vector) :: p(0:n-1)
real(r64) :: areap
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
type (vector) :: edge0, edge1, nor, edgex
integer i
type (vector) :: csum
edge0=p(1)-p(0)
edge1=p(2)-p(0)
edgex=edge0*edge1
nor =VecNormalize(edge0*edge1)
! Initialize csum
csum=0.0d0
do i=0,n-2
csum=csum+p(i)*p(i+1)
enddo
csum=csum+p(n-1)*p(0)
areap=0.5d0*abs(nor.dot.csum)
return
END FUNCTION AreaPolygon