Changeset 9287
 Timestamp:
 20170731 19:53:46 (6 years ago)
 Location:
 2017/30/MikkoH/Sq
 Files:

 6 edited
Legend:
 Unmodified
 Added
 Removed

2017/30/MikkoH/Sq/Sq/Sq/Sq.cs
r9286 r9287 6 6 { 7 7 List<Vector> ps, crc; 8 double rad = 50, radc = 0.01, mag = 4; 8 int dist = 10, pts = 150, mag = 100, minmag = 1, maxmag = 300, magc = 4, minrad = 1, maxrad = 100; 9 double rad = 50, radc = 0.01; 9 10 10 11 public override void Begin() … … 14 15 Level.Background.Color = Color.Black; 15 16 16 ps = CreateSquare( 100, 10);17 crc = CreateCircle( 50, 150);17 ps = CreateSquare(mag, dist); 18 crc = CreateCircle(rad, pts); 18 19 } 19 20 … … 30 31 31 32 // r = radius, n = number of pts 32 List<Vector> CreateCircle( int r, intn)33 List<Vector> CreateCircle(double r, double n) 33 34 { 34 35 List<Vector> crc = new List<Vector>(); … … 51 52 c.BrushColor = Color.Red; 52 53 54 // draws and squeezes the square 53 55 for (int i = 0; i < ps.Count; i++) 54 56 { 55 57 c.DrawLine(ps[i % ps.Count], ps[(i + ps.Count / 4) % ps.Count]); 56 ps[i] = Vector.FromLengthAndAngle(ps[i].Magnitude + mag , ps[i].Angle);57 if (ps[i].Magnitude < 1  ps[i].Magnitude > 300)58 mag = mag;58 ps[i] = Vector.FromLengthAndAngle(ps[i].Magnitude + magc, ps[i].Angle); 59 if (ps[i].Magnitude < minmag  ps[i].Magnitude > maxmag) 60 magc = magc; 59 61 } 60 62 61 63 c.BrushColor = Color.Blue; 62 64 65 // draws and squeezes the circle 63 66 for (int i = 0; i < crc.Count; i++) 64 67 { 65 68 c.DrawLine(crc[i % crc.Count], crc[(i + 2) % crc.Count]); 66 69 crc[i] = new Vector(Math.Sin(i) * rad, Math.Cos(i) * rad); 67 if (rad < 1  rad > 100) radc = radc;70 if (rad < minrad  rad > maxrad) radc = radc; 68 71 rad = radc; 69 72 }
Note: See TracChangeset
for help on using the changeset viewer.