|
@@ -5,7 +5,6 @@
|
|
|
*
|
|
|
*/
|
|
|
|
|
|
-
|
|
|
THREE.ParametricGeometries = {
|
|
|
|
|
|
klein: function ( v, u ) {
|
|
@@ -181,33 +180,31 @@ THREE.ParametricGeometries.TorusKnotGeometry = function ( radius, tube, segments
|
|
|
this.p = p || 2;
|
|
|
this.q = q || 3;
|
|
|
|
|
|
- var TorusKnotCurve = THREE.Curve.create(
|
|
|
+ function TorusKnotCurve() {}
|
|
|
|
|
|
- function() {
|
|
|
- },
|
|
|
+ TorusKnotCurve.prototype = Object.create( THREE.Curve.prototype );
|
|
|
+ TorusKnotCurve.prototype.constructor = TorusKnotCurve;
|
|
|
|
|
|
- function( t ) {
|
|
|
+ TorusKnotCurve.prototype.getPoint = function( t ){
|
|
|
|
|
|
- t *= Math.PI * 2;
|
|
|
+ t *= Math.PI * 2;
|
|
|
|
|
|
- var r = 0.5;
|
|
|
+ var r = 0.5;
|
|
|
|
|
|
- var tx = ( 1 + r * Math.cos( q * t ) ) * Math.cos( p * t ),
|
|
|
- ty = ( 1 + r * Math.cos( q * t ) ) * Math.sin( p * t ),
|
|
|
- tz = r * Math.sin( q * t );
|
|
|
+ var tx = ( 1 + r * Math.cos( q * t ) ) * Math.cos( p * t ),
|
|
|
+ ty = ( 1 + r * Math.cos( q * t ) ) * Math.sin( p * t ),
|
|
|
+ tz = r * Math.sin( q * t );
|
|
|
|
|
|
- return new THREE.Vector3( tx, ty, tz ).multiplyScalar( radius );
|
|
|
+ return new THREE.Vector3( tx, ty, tz ).multiplyScalar( radius );
|
|
|
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
- );
|
|
|
var segments = segmentsT;
|
|
|
var radiusSegments = segmentsR;
|
|
|
var extrudePath = new TorusKnotCurve();
|
|
|
|
|
|
THREE.ParametricGeometries.TubeGeometry.call( this, extrudePath, segments, tube, radiusSegments, true, false );
|
|
|
|
|
|
-
|
|
|
};
|
|
|
|
|
|
THREE.ParametricGeometries.TorusKnotGeometry.prototype = Object.create( THREE.Geometry.prototype );
|