Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
Bug

Journal ReciprocityProject's Journal: An hour of my life I'll never get back :-/ 2

I'm not going to tell you what this is supposed to do, or even what language it's written in.  See if you can find the line of code that doesn't belong with the others.  (hint: it's really, really lame)

#macro lerptounit( a, b, p )
    ((p-a)/(b-a))
#end

#macro bilerp( a, b, aprime, control, bprime, p )
  ((lerptounit( a, b, p ) * (control-aprime) + aprime) * (1-lerptounit( a, b, p )) +
  (lerptounit( a, b, p ) * (bprime-control) + control) * lerptounit( a, b, p ))
#end

#macro camera_position( p )
  (
  #if( p < 3 )
    x*bilerp( 0, 3, -100000, -2500, -1000, p )
  #else
  #if( p >= 3 & p < 6 )
    x*bilerp( 3, 6, -1000, 500, 2000, p ) +
    y*bilerp( 3, 6, 0, 0, 1000, p )
  #else
  #if( p >= 6 & p < 9 )
    x*bilerp( 6, 9, 2000, 3500, 3500, p ) +
    y*bilerp( 6, 9, 1000, 2000, 2000, p ) +
    z*bilerp( 6, 9, 0, 0, -2000, p )
  #else
  #if( p >= 9 & p < 12 )
    x*bilerp( 9, 12, 3500, 3500, 2500, p ) +
    y*bilerp( 9, 12, 2000, 2000, 1000, p ) +
    z*bilerp( 9, 12, -2000, -4000, -4000, p )
  #else
  #if( p >= 12 & p < 15 )
    x*bilerp( 12, 15, 2500, 1500, 750, p ) +
    y*bilerp( 12, 15, 1000, 0, 0, p ) +
    z*bilerp( 12, 15, -4000, -4000, -2000, p )
  #else
  #if( p >= 15 & p < 18 )
    x*bilerp( 15, 18, 750, 0, 0, p ) +
    z*bilerp( 18, 15, -2000, 0, 0, p )
  #else
  #if( p >= 18 & p < 21 )
    0
  #else
  #if( p >= 21 & p < 24 )
    y*bilerp( 21, 24, 0, 0, 10000, p ) +
    z*bilerp( 21, 24, 0, 0, 10000, p )
  #else
  #if( p >= 24 & p < 27 )
    x*bilerp( 24, 27, 0, 0, -10000, p ) +
    y*bilerp( 24, 27, 10000, 20000, 30000, p ) +
    z*bilerp( 24, 27, 10000, 20000, 30000, p )
  #else
  #if( p >= 27 )
    x*bilerp( 27, 30, -10000, -20000, -20000, p ) +
    y*bilerp( 27, 30, 30000, 40000, 40000, p ) +
    z*bilerp( 27, 30, 30000, 40000, 40000, p )
  #end #end #end #end #end #end #end #end #end #end
  )
#end

#macro camera_look_at( p )
  ( camera_position( p ) + camera_position( p + 6 ) - camera_position( p + 3 ) )
#end

#declare pmoo = 0;
#while( pmoo < 30 )
  sphere {
    camera_position( pmoo ) - y*30,
    15

    pigment{ rgb<1,0.4,0> }
    finish{ ambient 1 }
  }

  #declare pmoo = pmoo + 0.1;
#end
This discussion has been archived. No new comments can be posted.

An hour of my life I'll never get back :-/

Comments Filter:

Established technology tends to persist in the face of new technology. -- G. Blaauw, one of the designers of System 360

Working...