 Timestamp:
 20170731 19:38:44 (2 years ago)
 Location:
 2017/30/MikkoH/Sq
 Files:

 6 edited
Legend:
 Unmodified
 Added
 Removed

2017/30/MikkoH/Sq/Sq/Sq/Sq.cs
r9285 r9286 6 6 { 7 7 List<Vector> ps, crc; 8 double rad = 50, radc = 0.01, mag = 2;8 double rad = 50, radc = 0.01, mag = 4; 9 9 10 10 public override void Begin() … … 15 15 16 16 ps = CreateSquare(100, 10); 17 crc = CreateCircle(50, 150); 18 } 17 crc = CreateCircle(50, 150); 18 } 19 19 20 20 // s = length of side, d = distance between pts … … 29 29 } 30 30 31 // r ad = startingradius, n = number of pts32 List<Vector> CreateCircle(int r ad, int n)31 // r = radius, n = number of pts 32 List<Vector> CreateCircle(int r, int n) 33 33 { 34 34 List<Vector> crc = new List<Vector>(); 35 35 for (int i = 0; i <= n; i++) 36 crc.Add(new Vector(Math.Sin(i) * r ad, Math.Cos(i) * rad));36 crc.Add(new Vector(Math.Sin(i) * r, Math.Cos(i) * r)); 37 37 return crc; 38 38 } 39 39 40 // rotates any shape clockwise or anti if reversed41 40 void Rotate(List<Vector> vs, bool reverse = false) 42 41 { … … 48 47 } 49 48 50 // does everything51 49 protected override void Paint(Canvas c) 52 50 { 53 51 c.BrushColor = Color.Red; 54 52 55 // draws the square and squeezes it56 53 for (int i = 0; i < ps.Count; i++) 57 54 { 58 55 c.DrawLine(ps[i % ps.Count], ps[(i + ps.Count / 4) % ps.Count]); 59 //ps[i] = Vector.FromLengthAndAngle(ps[i].Magnitude + mag, ps[i].Angle);60 if (ps[i].Magnitude < 1  ps[i].Magnitude > 200) mag = mag;61 ps[i] += new Vector(5, 5);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; 62 59 } 63 60 64 61 c.BrushColor = Color.Blue; 65 62 66 // draws the circle and squeezes it67 63 for (int i = 0; i < crc.Count; i++) 68 64 {
Note: See TracChangeset
for help on using the changeset viewer.