Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=r64), | intent(in) | :: | qx | |||
real(kind=r64), | intent(in) | :: | qy | |||
real(kind=r64), | intent(in) | :: | x1 | |||
real(kind=r64), | intent(in) | :: | y1 | |||
real(kind=r64), | intent(in) | :: | x2 | |||
real(kind=r64), | intent(in) | :: | y2 | |||
real(kind=r64), | intent(in) | :: | x3 | |||
real(kind=r64), | intent(in) | :: | y3 |
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.
LOGICAL FUNCTION isInTriangle(qx,qy,x1,y1,x2,y2,x3,y3)
! SUBROUTINE INFORMATION:
! AUTHOR Jason Glazer
! DATE WRITTEN June 2005
! MODIFIED
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Determine if point q is in triangle defined by points a,b,c
! METHODOLOGY EMPLOYED:
! The function used three times is positive the point is on the "right"
! side and negative if on "left" side. By checking to make sure the signs
! are always the same. it determines that the point is inside of the
! triangle.
! REFERENCES:
! http://mcraefamily.com/MathHelp/GeometryPointAndTriangle2.htm
! USE STATEMENTS:
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
! na
! SUBROUTINE PARAMETER DEFINITIONS:
REAL(r64), INTENT(IN) :: qx
REAL(r64), INTENT(IN) :: qy
REAL(r64), INTENT(IN) :: x1
REAL(r64), INTENT(IN) :: y1
REAL(r64), INTENT(IN) :: x2
REAL(r64), INTENT(IN) :: y2
REAL(r64), INTENT(IN) :: x3
REAL(r64), INTENT(IN) :: y3
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
REAL(r64) :: fAB
REAL(r64) :: fCA
REAL(r64) :: fBC
fAB = (qy - y1) * (x2 - x1) - (qx - x1) * (y2 - y1)
fCA = (qy - y3) * (x1 - x3) - (qx - x3) * (y1 - y3)
fBC = (qy - y2) * (x3 - x2) - (qx - x2) * (y3 - y2)
IF ((fAB * fBC) .GE. 0.0d0 .AND. (fBC * fCA) .GE. 0.0d0) THEN
isInTriangle = .TRUE.
ELSE
isInTriangle = .FALSE.
END IF
END FUNCTION isInTriangle