<commit_before><!DOCTYPE html>
<html lang="en">
	<head>
		<title>three.js misc - geometry - polyfield</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<style>
			body {
				background-color: #ffffff;
				margin: 0px;
				overflow: hidden;
			}
		</style>
	</head>
	<body>

		<script src="../build/three.min.js"></script>

		<script src="js/renderers/SVGRenderer.js"></script>
		<script src="js/renderers/SoftwareRenderer.js"></script>
		<script src="js/libs/stats.min.js"></script>

		<script src="obj/Qrcode.js"></script>

		<script>

			var SCREEN_WIDTH = window.innerWidth / 2;
			var SCREEN_HEIGHT = window.innerHeight / 2;
			var AMOUNT = 100;

			var container, stats;

			var camera, scene;
			var canvasRenderer, svgRenderer, softwareRenderer, webglRenderer;

			var mesh, group;

			var mouseX = 0, mouseY = 0;

			var windowHalfX = window.innerWidth / 2;
			var windowHalfY = window.innerHeight / 2;

			init();
			animate();

			function init() {

				container = document.createElement( 'div' );
				document.body.appendChild( container );

				camera = new THREE.PerspectiveCamera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
				camera.position.z = 500;

				scene = new THREE.Scene();

				// QRCODE

				mesh = new THREE.Mesh( new Qrcode(), new THREE.MeshLambertMaterial( { /*emissive: 0xff0000,*/ vertexColors: THREE.FaceColors } ) );
				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
				scene.add( mesh );

				// CUBES

				var cube = new THREE.CubeGeometry( 100, 100, 100 );

				mesh = new THREE.Mesh( cube, new THREE.MeshBasicMaterial( { color: 0x0000ff, opacity: 0.5, transparent: true } ) );
				mesh.position.x = 500;
				mesh.rotation.x = Math.random();
				mesh.rotation.y = Math.random();
				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
				scene.add( mesh );

				mesh = new THREE.Mesh( cube, new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
				mesh.position.x = 500;
				mesh.position.y = 500;
				mesh.rotation.x = Math.random();
				mesh.rotation.y = Math.random();
				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
				scene.add( mesh );

				// PLANE

				mesh = new THREE.Mesh( new THREE.PlaneGeometry( 100, 100 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, side: THREE.DoubleSide } ) );
				mesh.position.y = -500;
				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
				scene.add( mesh );

				// CYLINDER

				mesh = new THREE.Mesh( new THREE.CylinderGeometry( 20, 100, 200, 10 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
				mesh.position.x = -500;
				mesh.rotation.x = - Math.PI / 2;
				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
				scene.add( mesh );

				// POLYFIELD

				var geometry = new THREE.Geometry();
				var materials = [];

				for ( var i = 0; i < 100; i ++ ) {

					var v = new THREE.Vector3( Math.random() * 1000 - 500, Math.random() * 1000 - 500, Math.random() * 1000 - 500 );

					var v0 = new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 );
					var v1 = new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 );
					var v2 = new THREE.Vector3( Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50 );

					v0.add( v );
					v1.add( v );
					v2.add( v );

					var face = new THREE.Face3( geometry.vertices.push( v0 ) - 1, geometry.vertices.push( v1 ) - 1, geometry.vertices.push( v2 ) - 1, null, null, i );

					geometry.faces.push( face );

					materials.push( new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, side: THREE.DoubleSide } ) );

				}

				geometry.computeFaceNormals();
				geometry.computeCentroids();

				group = new THREE.Object3D();
				group.scale.x = group.scale.y = group.scale.z = 2;
				scene.add( group );

				mesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial( materials ) );
				group.add( mesh );

				// LIGHTS

				var ambient = new THREE.AmbientLight( 0x80ffff );
				scene.add( ambient );

				var directional = new THREE.DirectionalLight( 0xffff00 );
				directional.position.set( - 1, 0.5, 0 );
				scene.add( directional );

				canvasRenderer = new THREE.CanvasRenderer();
				canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				container.appendChild( canvasRenderer.domElement );

				svgRenderer = new THREE.SVGRenderer();
				svgRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				svgRenderer.setQuality( 'low' );
				container.appendChild( svgRenderer.domElement );

				softwareRenderer = new THREE.SoftwareRenderer();
				softwareRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				container.appendChild( softwareRenderer.domElement );

				webglRenderer = new THREE.WebGLRenderer( { antialias: true } );
				webglRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				container.appendChild( webglRenderer.domElement );

				stats = new Stats();
				stats.domElement.style.position = 'absolute';
				stats.domElement.style.top = '0px';
				container.appendChild( stats.domElement );

				document.addEventListener( 'mousemove', onDocumentMouseMove, false );

				//

				window.addEventListener( 'resize', onWindowResize, false );

			}

			function onWindowResize() {

				windowHalfX = window.innerWidth / 2;
				windowHalfY = window.innerHeight / 2;

				SCREEN_WIDTH = window.innerWidth / 2;
				SCREEN_HEIGHT = window.innerHeight / 2;

				camera.aspect = SCREEN_WIDTH / window.SCREEN_HEIGHT;
				camera.updateProjectionMatrix();

				canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				svgRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				softwareRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				webglRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );

			}

			function onDocumentMouseMove(event) {

				mouseX = ( event.clientX - windowHalfX );
				mouseY = ( event.clientY - windowHalfY );

			}

			//

			function animate() {

				requestAnimationFrame( animate );

				render();
				stats.update();

			}

			function render() {

				camera.position.x += ( mouseX - camera.position.x ) * .05;
				camera.position.y += ( - mouseY - camera.position.y ) * .05;
				camera.lookAt( scene.position );

				group.rotation.y += 0.01;

				canvasRenderer.render( scene, camera );
				svgRenderer.render( scene, camera );
				softwareRenderer.render( scene, camera );
				webglRenderer.render( scene, camera );

			}

		</script>

	</body>
</html>
<commit_msg>Nicer code/approach in ubiquity test.<commit_after><!DOCTYPE html>
<html lang="en">
	<head>
		<title>three.js misc - geometry - polyfield</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<style>
			body {
				background-color: #ffffff;
				margin: 0px;
				overflow: hidden;
			}
		</style>
	</head>
	<body>

		<script src="../build/three.min.js"></script>

		<script src="js/renderers/SVGRenderer.js"></script>
		<script src="js/renderers/SoftwareRenderer.js"></script>
		<script src="js/libs/stats.min.js"></script>

		<script src="obj/Qrcode.js"></script>

		<script>

			var SCREEN_WIDTH = window.innerWidth / 2;
			var SCREEN_HEIGHT = window.innerHeight / 2;
			var AMOUNT = 100;

			var container, stats;

			var camera, scene;
			var canvasRenderer, svgRenderer, softwareRenderer, webglRenderer;

			var mesh, group;

			var mouseX = 0, mouseY = 0;

			var windowHalfX = window.innerWidth / 2;
			var windowHalfY = window.innerHeight / 2;

			init();
			animate();

			function init() {

				container = document.createElement( 'div' );
				document.body.appendChild( container );

				camera = new THREE.PerspectiveCamera( 75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000 );
				camera.position.z = 500;

				scene = new THREE.Scene();

				// QRCODE

				mesh = new THREE.Mesh( new Qrcode(), new THREE.MeshLambertMaterial( { /*emissive: 0xff0000,*/ vertexColors: THREE.FaceColors } ) );
				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
				scene.add( mesh );

				// CUBES

				var cube = new THREE.CubeGeometry( 100, 100, 100 );

				mesh = new THREE.Mesh( cube, new THREE.MeshBasicMaterial( { color: 0x0000ff, opacity: 0.5, transparent: true } ) );
				mesh.position.x = 500;
				mesh.rotation.x = Math.random();
				mesh.rotation.y = Math.random();
				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
				scene.add( mesh );

				mesh = new THREE.Mesh( cube, new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
				mesh.position.x = 500;
				mesh.position.y = 500;
				mesh.rotation.x = Math.random();
				mesh.rotation.y = Math.random();
				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
				scene.add( mesh );

				// PLANE

				mesh = new THREE.Mesh( new THREE.PlaneGeometry( 100, 100 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff, side: THREE.DoubleSide } ) );
				mesh.position.y = -500;
				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
				scene.add( mesh );

				// CYLINDER

				mesh = new THREE.Mesh( new THREE.CylinderGeometry( 20, 100, 200, 10 ), new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } ) );
				mesh.position.x = -500;
				mesh.rotation.x = - Math.PI / 2;
				mesh.scale.x = mesh.scale.y = mesh.scale.z = 2;
				scene.add( mesh );

				// POLYFIELD

				var geometry = new THREE.Geometry();
				var material = new THREE.MeshBasicMaterial( { vertexColors: THREE.FaceColors, side: THREE.DoubleSide } );

				for ( var i = 0; i < 100; i ++ ) {

					var v = new THREE.Vector3(
						Math.random() * 1000 - 500,
						Math.random() * 1000 - 500,
						Math.random() * 1000 - 500
					);

					var v0 = new THREE.Vector3(
						Math.random() * 100 - 50,
						Math.random() * 100 - 50,
						Math.random() * 100 - 50
					);

					var v1 = new THREE.Vector3(
						Math.random() * 100 - 50,
						Math.random() * 100 - 50,
						Math.random() * 100 - 50
					);

					var v2 = new THREE.Vector3(
						Math.random() * 100 - 50,
						Math.random() * 100 - 50,
						Math.random() * 100 - 50
					);

					v0.add( v );
					v1.add( v );
					v2.add( v );

					var face = new THREE.Face3(
						geometry.vertices.push( v0 ) - 1,
						geometry.vertices.push( v1 ) - 1,
						geometry.vertices.push( v2 ) - 1,
						null,
						new THREE.Color( Math.random() * 0xffffff )
					);

					geometry.faces.push( face );

				}

				geometry.computeFaceNormals();
				geometry.computeCentroids();

				group = new THREE.Mesh( geometry, material );
				group.scale.set( 2, 2, 2 );
				scene.add( group );

				// LIGHTS

				var ambient = new THREE.AmbientLight( 0x80ffff );
				scene.add( ambient );

				var directional = new THREE.DirectionalLight( 0xffff00 );
				directional.position.set( - 1, 0.5, 0 );
				scene.add( directional );

				canvasRenderer = new THREE.CanvasRenderer();
				canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				container.appendChild( canvasRenderer.domElement );

				svgRenderer = new THREE.SVGRenderer();
				svgRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				svgRenderer.setQuality( 'low' );
				container.appendChild( svgRenderer.domElement );

				softwareRenderer = new THREE.SoftwareRenderer();
				softwareRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				container.appendChild( softwareRenderer.domElement );

				webglRenderer = new THREE.WebGLRenderer( { antialias: true } );
				webglRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				container.appendChild( webglRenderer.domElement );

				stats = new Stats();
				stats.domElement.style.position = 'absolute';
				stats.domElement.style.top = '0px';
				container.appendChild( stats.domElement );

				document.addEventListener( 'mousemove', onDocumentMouseMove, false );

				//

				window.addEventListener( 'resize', onWindowResize, false );

			}

			function onWindowResize() {

				windowHalfX = window.innerWidth / 2;
				windowHalfY = window.innerHeight / 2;

				SCREEN_WIDTH = window.innerWidth / 2;
				SCREEN_HEIGHT = window.innerHeight / 2;

				camera.aspect = SCREEN_WIDTH / window.SCREEN_HEIGHT;
				camera.updateProjectionMatrix();

				canvasRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				svgRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				softwareRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				webglRenderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );

			}

			function onDocumentMouseMove(event) {

				mouseX = ( event.clientX - windowHalfX );
				mouseY = ( event.clientY - windowHalfY );

			}

			//

			function animate() {

				requestAnimationFrame( animate );

				render();
				stats.update();

			}

			function render() {

				camera.position.x += ( mouseX - camera.position.x ) * .05;
				camera.position.y += ( - mouseY - camera.position.y ) * .05;
				camera.lookAt( scene.position );

				group.rotation.y += 0.01;

				canvasRenderer.render( scene, camera );
				svgRenderer.render( scene, camera );
				softwareRenderer.render( scene, camera );
				webglRenderer.render( scene, camera );

			}

		</script>

	</body>
</html>

{'fraction_non_alphanumeric': 0.14224533496482106, 'fraction_numerical': 0.030666870602630774, 'mean_word_length': 2.8597992916174735, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1663839', 'n_tokens_mistral': 5764, 'n_tokens_neox': 4262, 'n_words': 965}