1 /**
  2  * @author mrdoob / http://mrdoob.com/
  3  */
  4 
  5 /**@constructor*/
  6 THREE.CylinderGeometry = function ( radiusTop, radiusBottom, height, radiusSegments, heightSegments, openEnded ) {
  7 
  8 	THREE.Geometry.call( this );
  9 
 10 	radiusTop = radiusTop !== undefined ? radiusTop : 20;
 11 	radiusBottom = radiusBottom !== undefined ? radiusBottom : 20;
 12 	height = height !== undefined ? height : 100;
 13 
 14 	var heightHalf = height / 2;
 15 	var segmentsX = radiusSegments || 8;
 16 	var segmentsY = heightSegments || 1;
 17 
 18 	var x, y, vertices = [], uvs = [];
 19 
 20 	for ( y = 0; y <= segmentsY; y ++ ) {
 21 
 22 		var verticesRow = [];
 23 		var uvsRow = [];
 24 
 25 		var v = y / segmentsY;
 26 		var radius = v * ( radiusBottom - radiusTop ) + radiusTop;
 27 
 28 		for ( x = 0; x <= segmentsX; x ++ ) {
 29 
 30 			var u = x / segmentsX;
 31 
 32 			var vertex = new THREE.Vector3();
 33 			vertex.x = radius * Math.sin( u * Math.PI * 2 );
 34 			vertex.y = - v * height + heightHalf;
 35 			vertex.z = radius * Math.cos( u * Math.PI * 2 );
 36 
 37 			this.vertices.push( vertex );
 38 
 39 			verticesRow.push( this.vertices.length - 1 );
 40 			uvsRow.push( new THREE.UV( u, 1 - v ) );
 41 
 42 		}
 43 
 44 		vertices.push( verticesRow );
 45 		uvs.push( uvsRow );
 46 
 47 	}
 48 
 49 	var tanTheta = ( radiusBottom - radiusTop ) / height;
 50 	var na, nb;
 51 
 52 	for ( x = 0; x < segmentsX; x ++ ) {
 53 
 54 		if ( radiusTop !== 0 ) {
 55 
 56 			na = this.vertices[ vertices[ 0 ][ x ] ].clone();
 57 			nb = this.vertices[ vertices[ 0 ][ x + 1 ] ].clone();
 58 
 59 		} else {
 60 
 61 			na = this.vertices[ vertices[ 1 ][ x ] ].clone();
 62 			nb = this.vertices[ vertices[ 1 ][ x + 1 ] ].clone();
 63 
 64 		}
 65 
 66 		na.setY( Math.sqrt( na.x * na.x + na.z * na.z ) * tanTheta ).normalize();
 67 		nb.setY( Math.sqrt( nb.x * nb.x + nb.z * nb.z ) * tanTheta ).normalize();
 68 
 69 		for ( y = 0; y < segmentsY; y ++ ) {
 70 
 71 			var v1 = vertices[ y ][ x ];
 72 			var v2 = vertices[ y + 1 ][ x ];
 73 			var v3 = vertices[ y + 1 ][ x + 1 ];
 74 			var v4 = vertices[ y ][ x + 1 ];
 75 
 76 			var n1 = na.clone();
 77 			var n2 = na.clone();
 78 			var n3 = nb.clone();
 79 			var n4 = nb.clone();
 80 
 81 			var uv1 = uvs[ y ][ x ].clone();
 82 			var uv2 = uvs[ y + 1 ][ x ].clone();
 83 			var uv3 = uvs[ y + 1 ][ x + 1 ].clone();
 84 			var uv4 = uvs[ y ][ x + 1 ].clone();
 85 
 86 			this.faces.push( new THREE.Face4( v1, v2, v3, v4, [ n1, n2, n3, n4 ] ) );
 87 			this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3, uv4 ] );
 88 
 89 		}
 90 
 91 	}
 92 
 93 	// top cap
 94 
 95 	if ( !openEnded && radiusTop > 0 ) {
 96 
 97 		this.vertices.push( new THREE.Vector3( 0, heightHalf, 0 ) );
 98 
 99 		for ( x = 0; x < segmentsX; x ++ ) {
100 
101 			var v1 = vertices[ 0 ][ x ];
102 			var v2 = vertices[ 0 ][ x + 1 ];
103 			var v3 = this.vertices.length - 1;
104 
105 			var n1 = new THREE.Vector3( 0, 1, 0 );
106 			var n2 = new THREE.Vector3( 0, 1, 0 );
107 			var n3 = new THREE.Vector3( 0, 1, 0 );
108 
109 			var uv1 = uvs[ 0 ][ x ].clone();
110 			var uv2 = uvs[ 0 ][ x + 1 ].clone();
111 			var uv3 = new THREE.UV( uv2.u, 0 );
112 
113 			this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) );
114 			this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );
115 
116 		}
117 
118 	}
119 
120 	// bottom cap
121 
122 	if ( !openEnded && radiusBottom > 0 ) {
123 
124 		this.vertices.push( new THREE.Vector3( 0, - heightHalf, 0 ) );
125 
126 		for ( x = 0; x < segmentsX; x ++ ) {
127 
128 			var v1 = vertices[ y ][ x + 1 ];
129 			var v2 = vertices[ y ][ x ];
130 			var v3 = this.vertices.length - 1;
131 
132 			var n1 = new THREE.Vector3( 0, - 1, 0 );
133 			var n2 = new THREE.Vector3( 0, - 1, 0 );
134 			var n3 = new THREE.Vector3( 0, - 1, 0 );
135 
136 			var uv1 = uvs[ y ][ x + 1 ].clone();
137 			var uv2 = uvs[ y ][ x ].clone();
138 			var uv3 = new THREE.UV( uv2.u, 1 );
139 
140 			this.faces.push( new THREE.Face3( v1, v2, v3, [ n1, n2, n3 ] ) );
141 			this.faceVertexUvs[ 0 ].push( [ uv1, uv2, uv3 ] );
142 
143 		}
144 
145 	}
146 
147 	this.computeCentroids();
148 	this.computeFaceNormals();
149 
150 }
151 
152 THREE.CylinderGeometry.prototype = Object.create( THREE.Geometry.prototype );
153 

nike free rn new balance hombre baratas cinturones gucci ugg rebajas cinturon gucci ray ban baratas nike cortez peuterey mujer christian louboutin madrid mbt zapatos gafas ray ban baratas mbt ofertas air max blancas mbt barcelona nike air max 90 woolrich barcelona nike mujer botas ugg gafas de sol carrera aratas air max 2016 baratas oakley baratas nike air max 2016

mbt skor nike sverige louboutin skor hollister sverige polo ralph lauren skjorta woolrich jacka dam canada goose jacka woolrich jacka ray ban rea canada goose rea michael kors rea new balance skor ralph lauren skjorta new balance rea uggs sverige lacoste rea christian louboutin skor moncler jacka nike shox barbour jacka uggs rea