ORCA-C/C.Samples/Graphic.Samples/Spiral.cc
Stephen Heumann 986fe9a65b Address issues in samples detected by new lint checks.
The only actual behavior change is in Ackermann.cc, which previously reported incorrectly high recursion depths for some calculations.
2023-04-23 19:35:16 -05:00

46 lines
917 B
C++

/****************************************************************
*
* Spiral
*
* A simple graphics demo. Uses the shell STOP command from the
* debug menu to stop the program early.
*
* by Mike Westerfield
*
* Copyright 1989
* Byte Works, Inc.
*
****************************************************************/
#pragma keep "Spiral"
#pragma lint -1
#include <quickdraw.h>
#include <math.h>
int main (void)
{
float r, theta, rot;
int color = 1;
Rect rect;
GetPortRect(&rect);
SetPenSize(3, 1);
for (rot = 0.0002; rot < 0.0005; rot += 0.0001) {
theta = 0.0;
r = 40.0;
MoveTo ((int) (cos (theta) * r * 3) + 160,
(int) (sin (theta) * r) + 40);
while (r > 0.0) {
SetSolidPenPat (color);
color ^= 3;
theta += 3.1415926535 / 21.0 + rot;
LineTo ((int) (cos (theta) * r * 3) + 160,
(int) (sin (theta) * r) + 40);
r -= 0.02;
}
}
Out: ;
}