# Changeset 9286

Ignore:
Timestamp:
2017-07-31 19:38:44 (4 years ago)
Message:

Location:
2017/30/MikkoH/Sq
Files:
6 edited

Unmodified
Added
Removed
• ## 2017/30/MikkoH/Sq/Sq/Sq/Sq.cs

 r9285 { List ps, crc; double rad = 50, radc = 0.01, mag = 2; double rad = 50, radc = 0.01, mag = 4; public override void Begin() ps = CreateSquare(100, 10); crc = CreateCircle(50, 150); } crc = CreateCircle(50, 150); } // s = length of side, d = distance between pts } // rad = starting radius, n = number of pts List CreateCircle(int rad, int n) // r = radius, n = number of pts List CreateCircle(int r, int n) { List crc = new List(); for (int i = 0; i <= n; i++) crc.Add(new Vector(Math.Sin(i) * rad, Math.Cos(i) * rad)); crc.Add(new Vector(Math.Sin(i) * r, Math.Cos(i) * r)); return crc; } // rotates any shape clockwise or anti if reversed void Rotate(List vs, bool reverse = false) { } // does everything protected override void Paint(Canvas c) { c.BrushColor = Color.Red; // draws the square and squeezes it for (int i = 0; i < ps.Count; i++) { c.DrawLine(ps[i % ps.Count], ps[(i + ps.Count / 4) % ps.Count]); //ps[i] = Vector.FromLengthAndAngle(ps[i].Magnitude + mag, ps[i].Angle); if (ps[i].Magnitude < 1 || ps[i].Magnitude > 200) mag = -mag; ps[i] += new Vector(5, 5); ps[i] = Vector.FromLengthAndAngle(ps[i].Magnitude + mag, ps[i].Angle); if (ps[i].Magnitude < 1 || ps[i].Magnitude > 300) mag = -mag; } c.BrushColor = Color.Blue; // draws the circle and squeezes it for (int i = 0; i < crc.Count; i++) {
Note: See TracChangeset for help on using the changeset viewer.