ASDFG

Dancing Fingers [Fingerbaby]

beêéè๐“ฎ๐•–๐”ขแต‰โ„ฏ๐‘’๐–พ๐•–๐™š๐šŽ๐—ฒ๐’†๐–Š๐šŽแต‰ëé๐–Šêèp



testing fingerbaby + doepfer dark time


Manipulate[ParametricPlot3D[ {Cos[\[Pi] \[Alpha] (3 - \[Alpha] - (-1 + \[Alpha]) Cos[\[Pi] Cos[ x + y]])] Sin[x] + Cos[y] Sin[\[Pi] \[Alpha] (3 - \[Alpha] - (-1 + \[Alpha]) Cos[\ \[Pi] Cos[x + y]])], Cos[\[Pi] Cos[x + y]], Cos[y] Cos[\[Pi] \[Alpha] (3 - \[Alpha] - (-1 + \[Alpha]) \ Cos[\[Pi] Cos[x + y]])] - Sin[x] Sin[\[Pi] \[Alpha] (3 - \[Alpha] - (-1 + \[Alpha]) Cos[\ \[Pi] Cos[x + y]])]}, {x, 0, 2 \[Pi]}, {y, 0, 2 \[Pi]}, PerformanceGoal -> Quality], {\[Alpha], 0, 1} ]



music: abby lee tee / speechless affairs / side b

testing my new toy …ย 

squeaking electro birdie.ย 

Mathematica code is (very roughly)ย 

pts = {a -> {0, 0, 0}, b -> {0, 1, 0}, c -> {1, 1, 0}, d -> {1, 0, 0},
    e -> {0, 0, 1}, f -> {0, 1, 1}, g -> {1, 1, 1}, h -> {1, 0, 1}}; 
poly = {a, b, c, g, f, b, f, e, h, g, c, d, h, d, a, e, a};
lines = Partition[poly, 2, 1]; (* draw lines between *) 
dts = 1/(Count[lines, #] + Count[lines, # // Reverse]) & /@ 
   lines; (* make duplicate lines half important *)

t0s = FoldList[Plus, 0, dts];
MapIndexed[With[{t0 = t0s[[#2[[1]]]], dt = dts[[#2[[1]]]]},
    {t <= 
      t0 + dt, #1[[2]] (t - t0)/dt + #1[[1]] (1 - (t - t0)/dt) /. 
       pts // Simplify}
    ] &, lines];
tmp = {t} \[Function] Which @@ (Flatten[%, 1]) // Evaluate;
cube[t_] := tmp[t*t0s[[-1]]];
fun[t_] = ({{1, 0, 0},{0, 0, 1}}).RotationMatrix[\[Pi] t, {1, 1, 1}].(cube[Mod[50 t, 1]] - 0.5) // Simplify // N;
nums = Table[fun[t], {t, 0, 2, 1/44100}];
ListPlay[Transpose[nums], SampleRate -> 44100]

mathematica webcam thing in 136 characters

m=MapIndexed;Dynamic[Graphics@m[{b,y}๏’กLine[10m[{#2[[1]],50-y[[1]]+#1}&,b]],Apply[Plus,ImageData@ImageResize[CurrentImage[],50],{2}]/3]]


In case copy&pasting doesn’t work for some reason … the crazy unicode symbol in the middle is esc fn esc

More Ray Experiments

fc[\[Beta]_, a_] = Simplify[R[\[Beta]].( {
       {1, 0},
       {0, -1}
      } ).R[-\[Beta]]].a;
Manipulate[
 Graphics[{
   Circle[{0, 0}, 1],
   Table[{
     Line[{a, {Cos[\[Alpha] \[Beta]], Sin[\[Alpha] \[Beta]]}, 
       fc[\[Alpha] \[Beta], a]}]
     }, 
    {\[Alpha], 0, 1 - 1/N, 1/N}
    ]
   },
  PlotRange -> {{-1, 1}, {-1, 1}} 
  ],
 {{a, {0, 0}}, Locator}, 
 {\[Beta], 0, 2 \[Pi]}, 
 {N, 1, 200}
 ]

Rays

import java.util.Iterator; 

int MAX_AGE = 500 ; 
int N = 1000; 
PGraphics copy; 

ArrayList rays = new ArrayList(); 
ArrayList planets = new ArrayList(); 


void setup(){
  size( 400, 400, P2D );
  copy = createGraphics(width, height);
  frameRate( 60 );
  smooth(); 
  
//  ray = new Ray( new PVector( 10, 10 ), new PVector( 20, 20.1 ), 1 );
//  planets.add( new Planet( new PVector( - 50, -50 ), 20 ) );
  planets.add( new Planet( new PVector( width/2, height/2 ), 12 ) );
  planets.add( new Planet( new PVector( width/2, height/2 - 60 ), 25 ) );
  strokeWeight( 1 ); 
}


void draw(){
  //background( 0 );
  noStroke(); 
  fill( 0, 40 );
  rect( 0, 0, width, height );
  
//  planets.get( 0 ).pos.x = mouseX;  
//  planets.get( 0 ).pos.y = mouseY;
  
//  planets.get( 1 ).pos.x = width/2+cos( frameCount*TWO_PI/500.0 )*100;  
//  planets.get( 1 ).pos.y = height/2+sin( frameCount*TWO_PI/500.0 )*90;
//  planets.get( 0 ).pos.x = width/2+cos( frameCount*TWO_PI/500.0 )*100 + cos( frameCount*TWO_PI/100.0 )*50;  
//  planets.get( 0 ).pos.y = height/2+sin( frameCount*TWO_PI/500.0 )*90 + sin( frameCount*TWO_PI/100.0 )*50;
  planets.get( 1 ).pos.x = width/2;  
  planets.get( 1 ).pos.y = height/2;
  planets.get( 0 ).pos.x = width/2 + cos( frameCount*TWO_PI/500.0 )*100;  
  planets.get( 0 ).pos.y = height/2+ sin( frameCount*TWO_PI/500.0 )*100;
  
  
 
  // make rays ... 
  for( int i = 0; i < N; i++ ){
//      rays.add( new Ray( new PVector(player.x, player.y), new PVector(mouseX, mouseY), 10 ) );
    PVector a = new PVector( width/2 - 200, height/2 );
//    float beta = random(TWO_PI);
    float beta = i*TWO_PI/N + frameCount%0.34; 
    PVector b = new PVector( a.x + 10*cos(beta), a.y+10*sin(beta) ); 
    rays.add( new Ray( a, b, 2 ) );
  } 
  
  for( Planet p : planets )
    p.draw(); 
  for(Iterator i = rays.iterator(); i.hasNext();) {
    Ray ray = i.next();
    for( int j = 0; j < 40; j++ ){ 
      ray.update();
      for( Planet p : planets ) 
        p.reflect( ray );
        
      if( ray.age > MAX_AGE || ray.a.x < 0 || ray.a.y < 0 || ray.a.x > width || ray.a.y > height ){
        i.remove(); 
        break;
      }
      else ray.draw();
    }
    
  }
  
   if( frameCount > 100 && frameCount % 5 == 0 ){
     loadPixels(); 
     updatePixels();
     copy.background(0); 
     copy.image( g, 0, 0 );
     copy.loadPixels();   
     //copy.updatePixels();   
     copy.save( "im/" + frameCount + ".jpg" );
   }  

//  saveFrame( "im/###.jpg" ); 
}



class Ray{
  PVector a;
  PVector b; 
  float v;
  int age; 
  public Ray( PVector a, PVector b, float v ){
    this.a = a; 
    this.b = b;
    this.v = v;    
  }
  
  public void update(){
    float dx = b.x - a.x; 
    float dy = b.y - a.y; 
    PVector delta = new PVector( b.x - a.x, b.y - a.y );
    delta.normalize();
    delta.mult( v ); 
    a.add( delta ); 
    b.add( delta );  
    age ++; 
  }
  
  public void draw(){
    stroke( 255, 255, 0, 10 );
    //noStroke();
    //rect( a.x, a.y, 3, 3 );   
    line( a.x, a.y, b.x+2, b.y );
    
  }

}


class Planet{
  PVector pos;  
  float r;
  float r2; 
  
  public Planet( PVector pos, float r ){
    this.pos = pos; 
    this.r = r;
    this.r2 = r*r; 
  }
  
  public void reflect( Ray ray ){
    
    float x1 = ray.a.x - pos.x; 
    float y1 = ray.a.y - pos.y; 
    float x2 = ray.b.x - pos.x; 
    float y2 = ray.b.y - pos.y; 
    float dx = ray.b.x - ray.a.x; 
    float dy = ray.b.y - ray.a.y; 
   
    // totally inside? f* this!
    //if( ray.b.dist( pos ) <= r ) ray.age = MAX_AGE;  
    
    // no distance -> weird
    if( dx == 0 && dy == 0 ) return;  
    
    float dr2 = sq( dx ) + sq( dy );
    float D = x1*y2 - x2*y1;
    float sgn = dy < 0? -1: 1;
    
    float delta = ( r2*dr2 - sq(D) );
    
    // no intersection
    if( delta < 0 ) return; 
    
    float delta1 = sqrt( delta );
    float xa = ( D*dy - sgn*dx*delta1 )/dr2; 
    float ya = (-D*dx - sgn*dy*delta1 )/dr2; 
    float xb = ( D*dy + sgn*dx*delta1 )/dr2; 
    float yb = (-D*dx + sgn*dy*delta1 )/dr2; 
    
    // take the solution closer to ray.b
    PVector hit; 
    if( sq( xa - x2 ) + sq( ya - y2 ) < sq( xb - x2 ) + sq( yb - y2 ) )
      hit = new PVector( xa, ya );
    else
      hit = new PVector( xb, yb );

    // is the hit point with a_b? 
    if( min( x1, x2 ) > hit.x || hit.x > max( x1, x2 ) || min( y1, y2 ) > hit.y | hit.y > max( y1, y2 ) )
      return; 
    
    // compute mirror point ...
    float beta = atan2( hit.y, hit.x );
    float s = sin( 2*beta );
    float c = cos( 2*beta ); 
    
//    ray.b = new PVector( pos.x + hit.x, pos.y + hit.y );
    ray.b = new PVector( pos.x + hit.x, pos.y + hit.y ); 
    ray.draw(); 
    ray.b = new PVector( pos.x + x1*c + y1*s, pos.y - y1*c + x1*s ); 
    ray.a = new PVector( pos.x + x2*c + y2*s, pos.y - y2*c + x2*s );
    // reflection is on  the inside? f* this!
    if( ray.b.dist( pos ) < r ) ray.age = MAX_AGE;  
    
    ray.update(); 
    strokeWeight(5); 
    stroke( 255, 50 ); 
    line( pos.x + hit.x, pos.y + hit.y, pos.x, pos.y ); 
    strokeWeight(1); 
    //PVector mirror = new PVector( x2*c + y2*s, - y2*c + x2*s );
    //set( (int)(pos.x+hit.x), (int)(pos.y+hit.y), color( 255, 255, 0 ) );
  }

  public void draw(){
    noStroke();  
    fill( 0, 50 ); 
    ellipse( pos.x, pos.y, 2*r, 2*r ); 
  }
  
}

OF code without the boilerplate:

void testApp::draw(){
delta = fmodf( ((1+frameCount)*0.01f), 4*TWO_PI ); maxJ = ofMap( frameCount, 0, numFrames, 1, 500 ); ofSetLineWidth( (2+3*frameCount/(float)numFrames)/height ); ofTranslate( width/2, height/2, 0 ); ofRotate(-90); ofTranslate(-height/2, 0); for( int i = 1; i <= maxI; i++ ){ for( int j = 0; j <= maxJ; j++ ){ plot( i, j, delta ); } }
}
void testApp::plot( int i, int j, float delta ){ float W = ofGetWidth(); float H = 4*ofGetHeight(); ofBeginShape(); float op = fmin(30,maxJ-j); ofSetColor( 0, frameCount < numFrames - 200? (int)op:(int)(op*ofMap(frameCount,numFrames-200,numFrames,1,3))); for( float t = 0; t <= 1; t += 0.01 ){ ofVertex( W*t, H*cos( 1 - 2.55*t - delta + j*TWO_PI/maxJ)*exp(-2*t)*pow((1/2+sin(delta/4+t+PI/4)), i/4)); } ofEndShape(); }

music: faxen, realoase