Changeset 9396 for 2017


Ignore:
Timestamp:
2017-08-03 14:45:11 (18 months ago)
Author:
mianhayr
Message:

väri skaalaa oikein

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

Legend:

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

    r9376 r9396  
    1010    public override void Begin() 
    1111    { 
    12         Level.Width = Level.Height = Window.Width = Window.Height = 800; 
     12        // Level.Width = Level.Height = Window.Width = Window.Height = 800; 
     13        Window.Height = 800; Window.Width = 1200; 
    1314        Mouse.IsCursorVisible = true; Level.Background.Color = Color.Black; 
    1415 
    15         sqs.Add(new Square(new Vector(0,0), 1, 400, 10));       
     16        sqs.Add(new Square(new Vector(0,0), 1, 400, 5));       
    1617    }       
    1718 
     
    2627 
    2728    protected override void Paint(Canvas c) 
    28     { 
    29         c.BrushColor = RandomGen.NextColor(); 
    30  
     29    {        
    3130        // loops through all squares to be drawn 
    3231        for (int i = 0; i < sqs.Count; i++) 
     
    3433            sqs[i].mag += sqs[i].magc = (glmin+(sqs[i].maxmag-sqs[i].mag) / // scales change to [glmin,glmax] 
    3534                (sqs[i].maxmag)*(glmax-glmin)) * Math.Sign(sqs[i].magc);    // and reduces current magnitude 
     35 
     36            int d = (int)(1 + sqs[i].mag / (sqs[i].maxmag - sqs[i].minmag) * (254)); 
     37            c.BrushColor = new Color(d, d, d); 
    3638 
    3739            for (int j = 0; j < sqs[i].Count; j++) 
     
    4446                sqs[i].magc = -sqs[i].magc; // reverse squeeze 
    4547 
    46                 sqs.Add(new Square(sqs[i].pos + new Vector(100, 100), sqs[i].minmag, sqs[i].maxmag/2, sqs[i].n/1)); 
    47                 sqs.Add(new Square(sqs[i].pos + new Vector(100, -100), sqs[i].minmag, sqs[i].maxmag/2, sqs[i].n / 1)); 
    48                 sqs.Add(new Square(sqs[i].pos + new Vector(-100, 100), sqs[i].minmag, sqs[i].maxmag/2, sqs[i].n / 1)); 
    49                 sqs.Add(new Square(sqs[i].pos + new Vector(-100, -100), sqs[i].minmag, sqs[i].maxmag/2, sqs[i].n / 1)); 
     48                sqs.Add(new Square(sqs[i].pos + new Vector(100, 0), sqs[i].minmag, sqs[i].maxmag/1.5, sqs[i].n-1)); 
     49                sqs.Add(new Square(sqs[i].pos + new Vector(-100, 0), sqs[i].minmag, sqs[i].maxmag, sqs[i].n)); 
     50                //sqs.Add(new Square(sqs[i].pos + new Vector(200, -100), sqs[i].minmag, sqs[i].maxmag/1.5, sqs[i].n-1)); 
    5051                sqs.Remove(sqs[i]); 
    5152            } 
     
    6566    public Vector pos; 
    6667 
    67     // min and max magnitude, d = number of pts/side 
    68     // sqs are always collections of unit vectors centered around 
    69     // origin, offset from origin is indicated by pos 
     68    // position, min and max magnitude, d = number of pts/side 
     69    // sqs are always collections of unit vectors centered around origin, offset from origin is indicated by pos 
    7070    public Square(Vector p, double min, double max, double d) 
    7171    { 
Note: See TracChangeset for help on using the changeset viewer.