diff --git a/build/three.js b/build/three.js index 54fe3722e5aa346084183369e0957d56d361c698..0c8183b1c6d3051ea438aaf484db2f2405de7187 100644 --- a/build/three.js +++ b/build/three.js @@ -33488,31 +33488,29 @@ THREE.TorusKnotGeometry = function ( radius, tube, radialSegments, tubularSegmen for ( var i = 0; i < this.radialSegments; ++ i ) { this.grid[ i ] = new Array( this.tubularSegments ); + var u = i / this.radialSegments * 2 * this.p * Math.PI; + var p1 = getPos( u, this.q, this.p, this.radius, this.heightScale ); + var p2 = getPos( u + 0.01, this.q, this.p, this.radius, this.heightScale ); + tang.subVectors( p2, p1 ); + n.addVectors( p2, p1 ); + + bitan.crossVectors( tang, n ); + n.crossVectors( bitan, tang ); + bitan.normalize(); + n.normalize(); for ( var j = 0; j < this.tubularSegments; ++ j ) { - var u = i / this.radialSegments * 2 * this.p * Math.PI; var v = j / this.tubularSegments * 2 * Math.PI; - var p1 = getPos( u, v, this.q, this.p, this.radius, this.heightScale ); - var p2 = getPos( u + 0.01, v, this.q, this.p, this.radius, this.heightScale ); - var cx, cy; - - tang.subVectors( p2, p1 ); - n.addVectors( p2, p1 ); - - bitan.crossVectors( tang, n ); - n.crossVectors( bitan, tang ); - bitan.normalize(); - n.normalize(); + var cx = - this.tube * Math.cos( v ); // TODO: Hack: Negating it so it faces outside. + var cy = this.tube * Math.sin( v ); - cx = - this.tube * Math.cos( v ); // TODO: Hack: Negating it so it faces outside. - cy = this.tube * Math.sin( v ); + var pos = new THREE.Vector3(); + pos.x = p1.x + cx * n.x + cy * bitan.x; + pos.y = p1.y + cx * n.y + cy * bitan.y; + pos.z = p1.z + cx * n.z + cy * bitan.z; - p1.x += cx * n.x + cy * bitan.x; - p1.y += cx * n.y + cy * bitan.y; - p1.z += cx * n.z + cy * bitan.z; - - this.grid[ i ][ j ] = vert( p1.x, p1.y, p1.z ); + this.grid[ i ][ j ] = scope.vertices.push( pos ) - 1; } @@ -33545,16 +33543,9 @@ THREE.TorusKnotGeometry = function ( radius, tube, radialSegments, tubularSegmen this.computeFaceNormals(); this.computeVertexNormals(); - function vert( x, y, z ) { - - return scope.vertices.push( new THREE.Vector3( x, y, z ) ) - 1; - - } - - function getPos( u, v, in_q, in_p, radius, heightScale ) { + function getPos( u, in_q, in_p, radius, heightScale ) { var cu = Math.cos( u ); - var cv = Math.cos( v ); var su = Math.sin( u ); var quOverP = in_q / in_p * u; var cs = Math.cos( quOverP ); diff --git a/build/three.min.js b/build/three.min.js index 047eeb1ce27e26c43bfa9f4f75e4e9ff221e7960..221016334d618ced97a7153edde2de4dddff1e66 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -619,7 +619,7 @@ t,p,r,[s,v,z,G]));this.faceVertexUvs[0].push([C,H,I,F])}}if(!1===f&&0g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).add(h).sub(a).clone()}function e(c,d){var e,f;for(O=c.length;0<=--O;){e=O;f=O-1;0>f&&(f=c.length-1);for(var g=0,h=q+2*l, -g=0;g