Reference Manual

  • 15.0
  • 07/23/2021
  • Public Content
Contents

Drawing a Sine Curve

With the axes and frame in place, Writing a Graphics Program Overview is ready to draw the sine curve. The
sinewave
routine calculates the x and y positions for two cycles and plots them on the screen:
! SINEWAVE - This subroutine calculates and plots a sine wave. SUBROUTINE sinewave( ) USE IFQWIN INTEGER(2) dummy, newx, newy, locx, locy, i INTEGER(4) color REAL rad EXTERNAL newx, newy PARAMETER ( PI = 3.14159 ) ! ! Calculate each position and display it on the screen. color = #0000FF ! red ! DO i = 0, 999, 3 rad = -SIN( PI * i / 250.0 ) locx = newx( i ) locy = newy( INT2( rad * 250.0 ) ) dummy = SETPIXELRGB( locx, locy, color ) END DO END SUBROUTINE
SETPIXELRGB
takes the two location parameters, locx and locy, and sets the pixel at that position with the specified color value (red).

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.