<commit_before>// An example of how to use Three.js to display a tubular shape.
var mesh, renderer, scene, camera, directionalLight;
init();

function render() {
  renderer.render(scene, camera);
}

// Generate N random points for constructing fiber. Points between [-1,10]
function randomPoints(N) {
  array = [];
  for (var i = 0; i < N; i++) {
    array[i] = [Math.floor(Math.random()*20-10),
                Math.floor(Math.random()*20-10),
                Math.floor(Math.random()*20-10)]
  }
  return array;
}

function init() {
  // The rendering engine is initialized
  renderer = new THREE.WebGLRenderer();
  renderer.setSize(window.innerWidth, window.innerHeight);

  // It is appended to the div container in the HTML5 tree
  document.getElementById('container').appendChild(renderer.domElement);
  var k=0;

  // We create a scene and a camera
  camera = new THREE.PerspectiveCamera(50,
                                       window.innerWidth / window.innerHeight,
                                       1,
                                       10000);

  // Create, the scene and add cameras, lights.
  scene = new THREE.Scene();
  scene.add(camera);
  scene.add(new THREE.AmbientLight( 0x888888 ) );
  var directionalLight = new THREE.DirectionalLight(0xffffff, 0.5);
  directionalLight.position.x = Math.random() - 0.5;
  directionalLight.position.y = Math.random() - 0.5;
  directionalLight.position.z = Math.random() - 0.5;
  directionalLight.position.normalize();
  scene.add(directionalLight);

  // Add the fiber and position camera
  var fiber = new FiberSource(randomPoints(4));
  var skeleton = new FiberSkeleton(fiber);
  scene.add(skeleton.line, skeleton.spheres)
  var tube = new FiberTube(fiber);
  // Timeout: In 5 secs from load, skeleton to turn into a tube fiber.
  setTimeout(function(){
    scene.add(tube.mesh);
    scene.remove(skeleton.spheres, skeleton.line)
    render()
  }, 5000);
  camera.position.set(0, 0, 40 * fiber.scale);

  renderer.render(scene, camera);

  // Add mouse control to the camera<commit_msg>Instead of timeout, change now takes place when any key is pressed.<commit_after>// An example of how to use Three.js to display a tubular shape.
var mesh, renderer, scene, camera, directionalLight;
init();

function render() {
  renderer.render(scene, camera);
}

// Generate N random points for constructing fiber. Points between [-1,10]
function randomPoints(N) {
  array = [];
  for (var i = 0; i < N; i++) {
    array[i] = [Math.floor(Math.random()*20-10),
                Math.floor(Math.random()*20-10),
                Math.floor(Math.random()*20-10)]
  }
  return array;
}

function init() {
  function switchtoTubeDisplay() {
    scene.remove(skeleton.spheres, skeleton.line);
    scene.add(tube.mesh);
    render();
  }

  // The rendering engine is initialized
  renderer = new THREE.WebGLRenderer();
  renderer.setSize(window.innerWidth, window.innerHeight);

  // It is appended to the div container in the HTML5 tree
  document.getElementById('container').appendChild(renderer.domElement);
  var k=0;

  // We create a scene and a camera
  camera = new THREE.PerspectiveCamera(50,
                                       window.innerWidth / window.innerHeight,
                                       1,
                                       10000);

  // Create, the scene and add cameras, lights.
  scene = new THREE.Scene();
  scene.add(camera);
  scene.add(new THREE.AmbientLight( 0x888888 ) );
  var directionalLight = new THREE.DirectionalLight(0xffffff, 0.5);
  directionalLight.position.x = Math.random() - 0.5;
  directionalLight.position.y = Math.random() - 0.5;
  directionalLight.position.z = Math.random() - 0.5;
  directionalLight.position.normalize();
  scene.add(directionalLight);

  // Add the fiber and position camera
  var fiber = new FiberSource(randomPoints(4));
  var skeleton = new FiberSkeleton(fiber);
  scene.add(skeleton.line, skeleton.spheres)
  var tube = new FiberTube(fiber);
  camera.position.set(0, 0, 40 * fiber.scale);

  window.addEventListener( 'keypress', switchtoTubeDisplay, false );

  renderer.render(scene, camera);

  // Add mouse control to the camera
{'fraction_non_alphanumeric': 0.12217954872779645, 'fraction_numerical': 0.023763802208353335, 'mean_word_length': 2.9053420805998127, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2810489', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1224, 'n_words': 343}