# Changeset 9373 for 2017/30

Ignore:
Timestamp:
2017-08-02 21:35:53 (3 years ago)
Message:

pyörii ja squeezaa täysin oikein/smoothisti/elegantisti
fuck yes

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

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

 r9372 //List crc; //double rad = 50, radc = 0.01, pts = 150, minrad = 1, maxrad = 200; double glmin = 0.5, glmax = 5; List sqs = new List(); for (int i = 0; i < sqs.Count; i++) { sqs[i].magc = (sqs[i].maxmag-sqs[i].mag)/(Math.Sign(sqs[i].magc)*30); // calculate magnitude change if (sqs[i].magc < -3) sqs[i].magc = -3; if (sqs[i].magc > 3) sqs[i].magc = 3; sqs[i].mag += sqs[i].magc; // reduce current magnitude, todo: clean sqs[i].mag += sqs[i].magc = (glmin+(sqs[i].maxmag - sqs[i].mag) / // scales change to [glmin,glmax] (sqs[i].maxmag)*(glmax-glmin)) * Math.Sign(sqs[i].magc);      // and reduces current magnitude for (int j = 0; j < sqs[i].Count; j++) c.DrawLine(sqs[i][j % sqs[i].Count] * sqs[i].mag, sqs[i][(j + sqs[i].Count / 4) % sqs[i].Count] * sqs[i].mag); //sq[i] = /*sq[i] * sq.mag;*/Vector.FromLengthAndAngle(sq[i].Magnitude * sq.mag, sq[i].Angle); //sq[i] += new Vector(1, 1); if (sqs[i].mag < sqs[i].minmag) { if (sqs[i].n == 0) Exit(); // minimum number of pts reached sqs[i].magc = -sqs[i].magc;   // reverse squeeze sqs[i].magc = -sqs[i].magc; // reverse squeeze sqs.Add(new Square(sqs[i].minmag, sqs[i].maxmag, sqs[i].n-1)); sqs.Remove(sqs[i]); } else if (sqs[i].mag > sqs[i].maxmag-5) // todo: replace offset const else if (sqs[i].mag > sqs[i].maxmag) sqs[i].magc = -sqs[i].magc; // reverse squeeze Rotate(sqs[i]); } // checks if squeeze direction should be reversed // merging this into the above loop will fuck everything up // also tries to create new squares //for (int i = 0; i < sqs.Count; i++) //c.BrushColor = Color.Blue; //} foreach (Square sq in sqs) Rotate(sq); //Rotate(crc, true); //foreach (Square sq in sqs) //Rotate(crc, true); base.Paint(c); class Square : List { public double n, mag, minmag , maxmag, magc = 3, lim; public double n, mag, minmag , maxmag, magc, lim; // min and max magnitude, d = number of pts/side public Square(double min, double max, double d) { n = d; mag = minmag = min; maxmag = max; lim = 2/(d+1); n = d; mag = minmag = magc = min; maxmag = max; lim = 2/(d+1); for (double i = -1; i < 1; i += lim) Add(new Vector(-1, i)); for (double i = -1; i < 1; i += lim) Add(new Vector(i, 1));
Note: See TracChangeset for help on using the changeset viewer.