 Timestamp:
 20170802 21:35:53 (20 months ago)
 Location:
 2017/30/MikkoH/Sq
 Files:

 6 edited
Legend:
 Unmodified
 Added
 Removed

2017/30/MikkoH/Sq/Sq/Sq/Sq.cs
r9372 r9373 7 7 //List<Vector> crc; 8 8 //double rad = 50, radc = 0.01, pts = 150, minrad = 1, maxrad = 200; 9 double glmin = 0.5, glmax = 5; 9 10 10 11 List<Square> sqs = new List<Square>(); … … 44 45 for (int i = 0; i < sqs.Count; i++) 45 46 { 46 sqs[i].mag c = (sqs[i].maxmagsqs[i].mag)/(Math.Sign(sqs[i].magc)*30); // calculate magnitude change47 if (sqs[i].magc < 3) sqs[i].magc = 3; if (sqs[i].magc > 3) sqs[i].magc = 3;48 sqs[i].mag += sqs[i].magc; // reduce current magnitude, todo: clean 47 sqs[i].mag += sqs[i].magc = (glmin+(sqs[i].maxmag  sqs[i].mag) / // scales change to [glmin,glmax] 48 (sqs[i].maxmag)*(glmaxglmin)) * Math.Sign(sqs[i].magc); // and reduces current magnitude 49 49 50 for (int j = 0; j < sqs[i].Count; j++) 50 51 c.DrawLine(sqs[i][j % sqs[i].Count] * sqs[i].mag, 51 52 sqs[i][(j + sqs[i].Count / 4) % sqs[i].Count] * sqs[i].mag); 52 //sq[i] = /*sq[i] * sq.mag;*/Vector.FromLengthAndAngle(sq[i].Magnitude * sq.mag, sq[i].Angle);53 //sq[i] += new Vector(1, 1);54 53 55 54 if (sqs[i].mag < sqs[i].minmag) 56 55 { 57 56 if (sqs[i].n == 0) Exit(); // minimum number of pts reached 58 sqs[i].magc = sqs[i].magc; 57 sqs[i].magc = sqs[i].magc; // reverse squeeze 59 58 sqs.Add(new Square(sqs[i].minmag, sqs[i].maxmag, sqs[i].n1)); 60 59 sqs.Remove(sqs[i]); 61 60 } 62 else if (sqs[i].mag > sqs[i].maxmag 5) // todo: replace offset const61 else if (sqs[i].mag > sqs[i].maxmag) 63 62 sqs[i].magc = sqs[i].magc; // reverse squeeze 63 64 Rotate(sqs[i]); 64 65 } 65 66 67 // checks if squeeze direction should be reversed68 // merging this into the above loop will fuck everything up69 // also tries to create new squares70 //for (int i = 0; i < sqs.Count; i++)71 72 66 73 67 //c.BrushColor = Color.Blue; … … 82 76 //} 83 77 84 foreach (Square sq in sqs) Rotate(sq);//Rotate(crc, true);78 //foreach (Square sq in sqs) //Rotate(crc, true); 85 79 86 80 base.Paint(c); … … 90 84 class Square : List<Vector> 91 85 { 92 public double n, mag, minmag , maxmag, magc = 3, lim;86 public double n, mag, minmag , maxmag, magc, lim; 93 87 94 88 // min and max magnitude, d = number of pts/side 95 89 public Square(double min, double max, double d) 96 90 { 97 n = d; mag = minmag = m in; maxmag = max; lim = 2/(d+1);91 n = d; mag = minmag = magc = min; maxmag = max; lim = 2/(d+1); 98 92 for (double i = 1; i < 1; i += lim) Add(new Vector(1, i)); 99 93 for (double i = 1; i < 1; i += lim) Add(new Vector(i, 1));
Note: See TracChangeset
for help on using the changeset viewer.