with: Erik Oosterwal
Area of an Opening
This collection of routines will return the area of regular and semi-regular
shaped holes or openings. I first wrote the routines when I was doing
analysis of competitors' appliances and one of the factors being looked at
was the size of the openings to various household appliances, such as washers,
dryers, and dishwashers.
The formulas are not rocket science, but I got tired of hauling out my cheat
sheet of seldom used mathematical expressions and decided to just code them
all up in a nifty FORTRAN program to make life a bit easier on me.
Besides, by using a standard program for all my calculations I could
quickly verify that my calculations were accurate over a long period of
time.
The program was originally written in FORTRAN to run on a VAX 11/780, a horrible
beast of a machine that you couldn't help but love. I recently found
a printout of the routines and decided to share the meaty part of the routines.
Rather than bore everyone with all the nifty calls to the various display
libraries and VT220 terminal settings, consider the enclosed routines as
the guts of the program and put your own display statements in as
necessary.
Circular Opening
C 3456789+123456789+123456789+123456789+
SUBROUTINE CIRC0()
C
INTEGER TERM
REAL*16 AREA, DIAM1, PI
CHARACTER RESP*11, ERRMSG*70
PI = 3.14159265359
C
10 WRITE('ENTER DIAMETER 1')
READ(RESP, '(F8.5)') DIAM1
IF (DIAM1 .EQ. 0) GOTO 40
C
20 AREA = (DIAM1/2.0)**2*PI
WRITE('TOTAL AREA = ', AREA)
GOTO 10
C
40 RETURN
END
Circular Opening with One Cut-out
C 3456789+123456789
SUBROUTINE CIRC1()
C
INTEGER TERM
REAL*16 AREA, DIAM1, DIAM2, TPAREA, RADIUS, THETA
REAL*16 PIE, TRANGL, PI
CHARACTER RESP*11, ERRMSG*70
PI=3.14159265359
C
10 WRITE ('ENTER DIAMETER 1')
READ (RESP, '(F8.5)') DIAM1
IF(DIAM1.EQ.0) GOTO 40
C
20 WRITE ('ENTER DIAMETER 2')
READ (RESP, '(F8.5)') DIAM2
IF (DIAM2.EQ.0) GOTO 40
C
30 IF(DIAM2.GT.DIAM1)THEN
ERRMSG='THE DIAMETER (A) MUST BE GREATER THEN ' //
'THE DEPTH (B) - PLEASE RE-ENTER'
CALL FDV$PUTL(ERRMSG) <- THIS IS VAX 11/780 SPECIFIC
GOTO 10
ENDIF
C
RADIUS = DIAM1/2.0
D = DIAM2-RADIUS
THETA = 2.0*(ACOS(D/RADIUS))
AREA = PI*RADIUS**2
PIE = PI*RADIUS**2*(THETA/(2.0*PI))
TRANGL = RADIUS*(SIN(THETA/2.0))*D
TPAREA = AREA-PIE+TRANGL
C
WRITE('TOTAL AREA = ', TPAREA)
GOTO 10
C
40 RETURN
END
Circular Opening with Two Cut-outs
Eliptical Opening
Rectangular Opening with Tight or Square Corners
Rectangular Opening with Rounded Corners
Discuss computer algorithms and other computer science topics at the Computer Algorithms blog page.
All code and original algorithms are © Erik Oosterwal - 1987-2008
Computer Science 101
Dressing for Success