Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | I | |||
integer, | intent(in) | :: | NS | |||
integer, | intent(in) | :: | NumVertices |
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.
SUBROUTINE HTRANS(I,NS,NumVertices)
! SUBROUTINE INFORMATION:
! AUTHOR Legacy Code
! DATE WRITTEN
! MODIFIED na
! RE-ENGINEERED Lawrie, Oct 2000
! PURPOSE OF THIS SUBROUTINE:
! This subroutine sets up the homogeneous coordinates.
! This routine converts the cartesian coordinates of a surface
! or shadow polygon to homogeneous coordinates. It also
! computes the area of the polygon.
! METHODOLOGY EMPLOYED:
! Note: Original legacy code used integer arithmetic (tests in subroutines
! INCLOS and INTCPT are sensitive to round-off error). However, porting to Fortran 77
! (BLAST/IBLAST) required some variables to become REAL(r64) instead.
! Notes on homogeneous coordinates:
! A point (X,Y) is represented by a 3-element vector
! (W*X,W*Y,W), where W may be any REAL(r64) number except 0. a line
! is also represented by a 3-element vector (A,B,C). The
! directed line (A,B,C) from point (W*X1,W*Y1,W) to point
! (V*X2,V*Y2,V) is given by (A,B,C) = (W*X1,W*Y1,W) cross
! (V*X2,V*Y2,V). The sequence of the cross product is a
! convention to determine sign. The condition that a point lie
! on a line is that (A,B,C) dot (W*X,W*Y,W) = 0. 'Normalize'
! the representation of a point by setting W to 1. Then if
! (A,B,C) dot (X,Y,1) > 0.0, The point is to the left of the
! line, and if it is less than zero, the point is to the right
! of the line. The intercept of two lines is given by
! (W*X,W*Y,W) = (A1,B1,C1) cross (A2,B2,C3).
! REFERENCES:
! BLAST/IBLAST code, original author George Walton
! W. M. Newman & R. F. Sproull, 'Principles of Interactive Computer Graphics', Appendix II, McGraw-Hill, 1973.
! 'CRC Math Tables', 22 ED, 'Analytic Geometry', P.369
! USE STATEMENTS:
USE General, ONLY: TrimSigDigits
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: I ! Mode selector: 0 - Compute H.C. of sides
! 1 - Compute H.C. of vertices & sides
INTEGER, INTENT(IN) :: NS ! Figure Number
INTEGER, INTENT(IN) :: NumVertices ! Number of vertices
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER N ! Loop Control (vertex number)
REAL(r64) SUM ! Sum variable
INTEGER(i64) :: ITEMP !
IF (NS > MaxHCS*2) THEN
CALL ShowFatalError('Solar Shading: HTrans: Too many Figures (>'//TRIM(TrimSigDigits(MaxHCS))//')')
ENDIF
HCNV(NS)=NumVertices
IF (I /= 0) THEN ! Transform vertices of figure ns.
! See comment at top of module regarding HCMULT
DO N = 1, NumVertices
ITEMP = NINT(XVS(N)*HCMULT,i64)
HCX(N,NS) = ITEMP
ITEMP = NINT(YVS(N)*HCMULT,i64)
HCY(N,NS) = ITEMP
END DO
END IF
! Establish extra point for finding lines between points.
HCX(NumVertices+1,NS)=HCX(1,NS)
HCY(NumVertices+1,NS)=HCY(1,NS)
! Determine lines between points.
SUM=0.0D0
DO N = 1, NumVertices
HCA(N,NS) = HCY(N,NS) - HCY(N+1,NS)
HCB(N,NS) = HCX(N+1,NS) - HCX(N,NS)
HCC(N,NS) = (HCY(N+1,NS)*HCX(N,NS)) - (HCX(N+1,NS)*HCY(N,NS))
SUM = SUM + HCC(N,NS)
END DO
! Compute area of polygon.
! SUM=0.0D0
! DO N = 1, NumVertices
! SUM = SUM + HCX(N,NS)*HCY(N+1,NS) - HCY(N,NS)*HCX(N+1,NS) ! Since HCX and HCY integerized, value of SUM should be ok
! END DO
HCAREA(NS)=(0.5d0*SUM)/(sqHCMULT)
! HCAREA(NS)=0.5d0*SUM*(kHCMULT)
RETURN
END SUBROUTINE HTRANS