smoot(3f) - [M_calcomp:scientific] draw a polyline using modified spline-fitting technique (LICENSE:PD)
Synopsis
Description
Options
Description
Comments
Examples
License
subroutine smoot(xpage,ypage,ipen)
SMOOT is a FORTRAN subroutine which draws a smooth curve through a set of data points. It accomplishes this by using a modified spline-fitting technique. The subroutine receives a single coordinate pair on each call and accumulates the points until it has received a sufficient number to compute a pair of cubic parametric equations for a smooth curve. This accumulation method requires the user to specify an initial and a terminal call to the subroutine.
The SMOOT subroutine operates in either of two modes: Smooth Mode and Plot Mode.
XPAGE,YPAGE are the coordinates, in inches, of a single point through which the pen moves. IPEN determines the mode and action of the SMOOT subroutine.
The first call to SMOOT must use an IPEN value of 0 or -1 to put SMOOT in the Smooth Mode.
if IPEN = 0, XPAGE,YPAGE define the initial point (P(1)) on the curve. The smoothing function ends at the last point (P(n)). An open curve is produced.SMOOTH MODE:if IPEN = -1, XPAGE,YPAGE are used to define the initial point (P(1)) on the curve. The smoothing function continues from the last point (P(n)) back to the initial point (P(1)). A closed curve is produced.
When SMOOT is in the Smooth Mode, IPEN performs the following functions:PLOT MODE:IPEN = -2 XPAGE,YPAGE are used to define points P(2), P(3),..., P(N-1), and a smoothed curve is drawn through the points on the curve.
IPEN = -3 XPAGE,YPAGE are used to define points P(2), P(3), ...,P(N-1), and the pen, in the up position, is moved through these points. The smoothing function is maintained.
IPEN = 2 or 3 The call is treated as a normal CALL PLOT (XPAGE,YPAGE,IPEN), and the point is not considered a point on the curve. The point of departure from the curve is the next-to-last point received by SMOOT, not the last point.
When the next call to SMOOT with IPEN = -2 or -3 is received, the pen is repositioned to the point where it left the smooth curve. The smooth curve is then continued as though the calls with IPEN = 2 or 3 had not occurred.
IPEN <=(-24) is used for the terminal call while SMOOT is in the Smooth Mode. XPAGE,YPAGE represent P(N). The curve is finished, and the subroutine returns to the Plot Mode.
SMOOT is in the Plot Mode after receiving a terminal call.
IF IPEN = +-2 or +-3, the call is treated as a normal CALL PLOT (XPAGE,YPAGE,IPEN).
When SMOOT is called while it is in the Smooth Mode, the pen is not moved until three points on an open curve or four points on a closed curve have been received. For subsequent calls to SMOOT, the actual pen position is the next-to-last point received.
Calls to other plotting subroutines may be intermixed with calls to SMOOT. Point-of-departure restrictions are the same as noted in the Smooth Mode description above.
The first call to SMOOT must be with IPEN = 0 or -1 .
Sample program
program demo_smoot use M_calcomp implicit none ! based on concepts of CALIFORNIA COMPUTER PRODUCTS, 1968 real :: xar(10)=[0.75,1.75,2.25,2.75,3.25,4.25,4.75,5.75,0.0,1.0] real :: yar(10)=[3.25,2.00,5.25,6.50,6.75,6.25,3.25,4.25,0.0,1.0] character(len=50) :: ibcd integer :: inteq call plots(0.0,10.0,0.0,10.0) ! DRAW FRAME call plot(7.0,0.0,2) call plot(7.0,9.0,2) call plot(0.0,9.0,2) call plot(0.0,0.0,2) ! DRAW AXIS ibcd=SERVICE TIME call axis(0.75,0.75,ibcd,-12,5.0,0.0,5.0,1.0) ibcd=FREQUENCY call axis(0.75,0.75,ibcd, 9,7.0,90.0,0.0,100.0) ! DRAW COMMENTS ibcd=USING FLINE AND SMOOT SUBROUTINES call symbol(0.7,8.25,0.14,ibcd,inteq,0.0,34) call plot(5.0,7.8,3) call plot(5.1,7.8,2) ibcd=SMOOT call symbol(5.2,7.80,0.09,ibcd,inteq,0.0, 6) inteq = 1 call symbol(5.0,7.60,0.10,ibcd,inteq,0.0,-1) inteq=999 ibcd=FLINE call symbol(5.2,7.60,0.09,ibcd,inteq,0.0, 5) ! SMOOTHING call smoot(0.75,3.75,0) call smoot(1.75,2.5,-2) call smoot(2.25,5.75,-2) call smoot(2.75,7.0,-2) call smoot(3.25,7.25,-2) call smoot(4.25,6.75,-2) call smoot(4.75,3.75,-2) call smoot(5.75,4.75,-24) ! FLINE IS USED call plot(0.75,3.25,3) call fline(xar, yar, -8,1,1,1) call nframe() end program demo_smoot
Public Domain
Nemo Release 3.1 | smoot (3) | February 23, 2025 |