A PHP Error was encountered
Severity: 8192
Message:  Function create_function() is deprecated
Filename: geshi/geshi.php
Line Number: 4698
	Backtrace:
	
		
	
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
			Line: 4698
			Function: _error_handler			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
			Line: 4621
			Function: _optimize_regexp_list_tokens_to_string			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
			Line: 1655
			Function: optimize_regexp_list			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
			Line: 2029
			Function: optimize_keyword_group			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
			Line: 2168
			Function: build_parse_cache			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
			Line: 45
			Function: parse_code			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
			Line: 517
			Function: syntax			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
			Line: 624
			Function: getPaste			
		
	
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
			Line: 315
			Function: require_once			
		
	
 
A PHP Error was encountered
Severity: Warning
Message:  Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/system/core/Exceptions.php:271)
Filename: view/download.php
Line Number: 2
	Backtrace:
	
		
	
		
	
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/themes/geocities/views/view/download.php
			Line: 2
			Function: header			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
			Line: 173
			Function: include			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
			Line: 43
			Function: _ci_load			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
			Line: 625
			Function: view			
		
	
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
			Line: 315
			Function: require_once			
		
	
 
A PHP Error was encountered
Severity: Warning
Message:  Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/system/core/Exceptions.php:271)
Filename: view/download.php
Line Number: 3
	Backtrace:
	
		
	
		
	
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/themes/geocities/views/view/download.php
			Line: 3
			Function: header			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
			Line: 173
			Function: include			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/core/MY_Loader.php
			Line: 43
			Function: _ci_load			
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
			Line: 625
			Function: view			
		
	
		
	
		
			
			File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
			Line: 315
			Function: require_once			
		
	
 let scene, camera, renderer, controls,
    geometry, material, anim,
    dirLight, ambLight, pointCount;
let dt, dx, dy, dz, x, y, z, a, b, c,
    lorenz, lorenzMat, lorenzGeo,
    positions, index;
let MAX_POINTS = 50000,
    drawCount = 1;
// --------------------------------------------------------------------- INITIALIZE BEGIN ----- //
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(
    35,
    window.innerWidth / window.innerHeight,
    0.1,
    10000
);
camera.position.z = 100;
renderer = new THREE.WebGLRenderer( {
    antialias: true
} );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setClearColor( 0x131112 );
renderer.setSize(
    window.innerWidth,
    window.innerHeight
);
document.body.appendChild( renderer.domElement );
controls = new THREE.OrbitControls( camera, renderer.domElement );
// --------------------------------------------------------------------- INITIALIZE END ----- //
// --------------------------------------------------------------------- LIGHTING BEGIN ----- //
ambLight = new THREE.AmbientLight(
    0xffffff,
    0
);
scene.add( ambLight );
// ---------------------------------------------------------------------- LIGHTING END ----- //
// ------------------------------------------------------------ LORENZ ATTRACTOR BEGIN ----- //
function randColor( a = 1.0 ) {
    let red = Math.round( Math.random() * 100 ),
        green = Math.round( Math.random() * 100 ),
        blue = Math.round( Math.random() * 100 ),
        alpha = a;
    
    const r = "red: " + red + "\n";
    const g = "green: " + green + "\n";
    const b = "blue: " + blue + "\n";
    
    let color = {
        red: red,
        green: green,
        blue: blue
    }
    
    const clr = new RColor();
    RColor.red = red;
    RColor.green = green;
    RColor.blue = blue;
    RColor.alpha = alpha;
}
/*
function rn( min = 0, max = 255 ) {
    let mn = Math.floor( Math.random() * Math.floor( min ));
    let mx = Math.ceil( Math.random() * Math.ceil( max ));
    
    function( mn, mx ) {
        return Math.round( Math.random() *  );
    }
}
console.log( rn() );
*/
function color( min = 0, max = 255 ) {
    let mn, mx, hx, arr, num, r, g, b;
    
    // Unused
    mn = Math.floor( Math.random() * min);
    mx = Math.ceil( Math.random() * max);
    
    // Random integer between min & max parameters
    hx = () => {
        let val = Math.floor( Math.random() * ( max - min )) + min;
        return val;
    };
    arr = [];
    num = 3;
    
    for ( let j = 0; j < num; ++j ) {
        // arr.push( hx );
        arr[j] = hx();
    }
    r = arr[0];
    g = arr[1];
    b = arr[2];
    
    let i, s, h,
        rmg, rmb, gmb;
    rmg = ( r - g );
    rmb = ( r - b );
    gmb = ( g - b );
    
    // RGB in relation to HSI
    i = ( r + g + b ) / 3;
    s = 1 - ( 3 / ( r + g + b )) * Math.min( r, g, b );
    h = Math.acos( Math.abs( rmg + rmb ) / Math.sqrt( Math.pow( rmg, 2 ) + Math.abs( rmb * gmb )));
    
    if ( b > g ) {
        h = 360 - h;
    }
    
    console.log( "hsi: " + h + ", " + s + ", " + i );
    console.log( "r: " + r + "\ng: " + g + "\nb: " + b );
}
color();
lorenzGeo = new THREE.BufferGeometry();
positions = new Float32Array( MAX_POINTS * 3);
lorenzGeo.setAttribute( "position", new THREE.BufferAttribute( positions, 3));
lorenzGeo.setDrawRange( 0, drawCount );
lorenzMat = new THREE.LineBasicMaterial({
    color: 0xff0000,
    linewidth: 0.1
});
attractor = new THREE.Line( lorenzGeo, lorenzMat );
scene.add( attractor );
//lorenzOrbital();
lorenzUpdate();
function lorenzUpdate() {
    positions = attractor.geometry.attributes.position.array;
    index = 0;
    x = y = z = 0.01;
    
    a = 10;
    b = 28;
    c = 8.0 / 3.0;
    
    dt = 0.01;
    
    for ( let i = 0, l = MAX_POINTS; i < l; ++i ) {
        positions[ index ++ ] = x;
        positions[ index ++ ] = y;
        positions[ index ++ ] = z;
        
        dx = ( a * ( y - x )) * dt;
        dy = ( x * ( b - z ) - y ) * dt;
        dz = ( x * y - c * z ) * dt;
        
        x += dx;
        y += dy;
        z += dz;
    }
    
}
// -------------------------------------------------------------- LORENZ ATTRACTOR END ----- //
/*
function lorenzOrbital() {
    positions = attractor.geometry.attributes.position.array;
    index = 0;
    x = y = z = 0.01;
    a = 0.96;
    b = 0.13;
    c = -0.67;
    d = 0;
    dt = 0.04;
    let h = 1.678;
    
    for ( let i = 0, l = MAX_POINTS; i < l; ++i ) {
        positions[ index ++ ] = x;
        positions[ index ++ ] = y;
        positions[ index ++ ] = z;
        
        dx = Math.sin( Math.cos( y ));
        dy = Math.sin( Math.sin( Math.cos( a )) / x );
        dz = Math.sin( y - z );
        
        x += dx * dt;
        y += dy * dt;
        z += dz * dt;
        
    }
    
    x += x + dx;
    y += y + dy;
    z += z + dz;
}
*/
// ------------------------------------------------------------ RENDER FUNCTIONS BEGIN ----- //
function animate() {
    anim = requestAnimationFrame( animate );
    
    drawCount = ( drawCount + 1 ) % MAX_POINTS;
    attractor.geometry.setDrawRange( 0, drawCount );
    
    if ( drawCount == ( MAX_POINTS - 2 )) {
        cancelAnimationFrame( anim );
        //lorenz.geometry.attributes.position.needsUpdate = false;
    } else {
        render();
    }
    counter.innerHTML = `` + ( drawCount + 1 ) % MAX_POINTS + ``
    controls.update();
}
function render() {
    if ( displayChanged( renderer )) {
        const canvas = renderer.domElement;
        camera.aspect = canvas.clientWidth / canvas.clientHeight;
        camera.updateProjectionMatrix();
    }
    renderer.render( scene, camera );
}
function displayChanged( renderer ) {
    const canvas = renderer.domElement;
    const width = canvas.clientWidth;
    const height = canvas.clientHeight;
    const needResize = canvas.width !== width || canvas.height !== height;
    if ( needResize ) {
        renderer.setSize( width, height, false );
    }
    return needResize;
}
// ----------------------------------------------------------- RENDER FUNCTIONS END ----- //
// ------------------------------------------------------------ MISCELLANEOUS BEGIN ----- //
controls.addEventListener( "change", render );
window.addEventListener( "resize", render );
let counter;
counter = document.querySelector( "#counter" );
// render();
animate();