Browse Source

Removed unused code.

Mr.doob 8 years ago
parent
commit
6f10d775cb

+ 0 - 180
src/math/Polygon.js

@@ -1,180 +0,0 @@
-/**
- * @author abelnation / http://github.com/abelnation
- */
-
-THREE.Polygon = function ( points ) {
-
-	this.points = points;
-
-};
-
-THREE.Polygon.prototype = {
-	constructor: THREE.Polygon,
-
-	// points: list of Vector3 objects
-	set: function ( points ) {
-
-		this.points = [];
-		for ( var i = 0; i < points.length; i++ ) {
-
-			this.points.push( points[ i ].copy() );
-
-		}
-		return this;
-
-	},
-
-	clone: function () {
-
-		var result = new this.constructor();
-		result.copy( this );
-		return result;
-
-	},
-
-	copy: function ( polygon ) {
-
-		this.points = Array.from( polygon.points );
-
-	},
-
-	empty: function () {
-
-		// TODO (abelnation): implement
-		return;
-
-	},
-
-	containsPoint: function ( point ) {
-
-		// TODO (abelnation): implement
-		return false;
-
-	},
-
-	distanceToPoint: function ( point ) {
-
-		// TODO (abelnation): implement
-		return 0;
-
-	},
-
-	intersectsSphere: function ( sphere ) {
-
-		// TODO (abelnation): implement
-		return false;
-
-	},
-
-	intersectsBox: function ( box ) {
-
-		// TODO (abelnation): implement
-		return false;
-
-	},
-
-	intersectsPlane: function ( plane ) {
-
-		// TODO (abelnation): implement
-		return false;
-
-	},
-
-	applyMatrix4: function ( matrix ) {
-
-		// TODO (abelnation): implement
-		return this;
-
-	},
-
-	translate: function ( offset ) {
-
-		// TODO (abelnation): implement
-		return this;
-
-	},
-
-	equals: function ( polygon ) {
-
-		// TODO (abelnation): implement
-		return false;
-
-	}
-};
-
-THREE.Polygon.makeSquare = function ( dim ) {
-
-	return THREE.Polygon.makeRectangle( dim, dim );
-
-};
-
-THREE.Polygon.makeRectangle = function ( width, height ) {
-
-	width = ( width !== undefined ) ? width : 10;
-	height = ( height !== undefined ) ? height : 10;
-
-	var halfWidth = width / 2.0;
-	var halfHeight = height / 2.0;
-
-	return new THREE.Polygon( [
-		new THREE.Vector3( - halfWidth,   halfHeight, 0 ),
-		new THREE.Vector3(   halfWidth,   halfHeight, 0 ),
-		new THREE.Vector3(   halfWidth, - halfHeight, 0 ),
-		new THREE.Vector3( - halfWidth, - halfHeight, 0 )
-	] );
-
-}
-
-THREE.Polygon.makeCircle = function ( radius, numPoints ) {
-
-	radius = ( radius !== undefined ) ? radius : 10.0;
-	numPoints = ( numPoints !== undefined ) ? numPoints : 5;
-
-	var twoPi = Math.PI * 2.0;
-	var theta = 0.0;
-	var dTheta = twoPi / numPoints;
-
-	var points = [];
-	for ( var i = 0; i < numPoints; i ++ ) {
-
-		theta = dTheta * i;
-		points.push( new THREE.Vector3(
-			Math.cos(theta) * radius,
-			Math.sin(theta) * radius,
-			0
-		) );
-
-	}
-
-	return new THREE.Polygon( points );
-
-}
-
-THREE.Polygon.makeStar = function ( numPoints, outerRadius, innerRadius ) {
-
-	numPoints = ( numPoints !== undefined ) ? numPoints : 5;
-	outerRadius = ( outerRadius !== undefined ) ? outerRadius : 10.0;
-	innerRadius = ( innerRadius !== undefined ) ? innerRadius : 5.0;
-
-	var theta;
-	var dTheta = ( Math.PI * 2.0 ) / numPoints / 2.0;
-	var points = [];
-
-	for ( var i = 0; i < numPoints; i ++ ) {
-
-		theta = dTheta * i * 2;
-		points.push( new THREE.Vector3(
-			outerRadius * Math.cos(theta),
-			outerRadius * Math.sin(theta),
-			0 ) );
-
-		theta += dTheta;
-		points.push( new THREE.Vector3(
-			innerRadius * Math.cos(theta),
-			innerRadius * Math.sin(theta),
-			0 ) );
-
-	}
-
-	return new THREE.Polygon( points );
-}

+ 1 - 20
src/math/Spherical.js

@@ -78,27 +78,8 @@ Spherical.prototype = {
 
 		return this;
 
-	},
-
-	getCartesian: function() {
-		if ( this.radius === 0 ) {
-
-			return new THREE.Vector3();
-
-		} else {
-
-			var sinPhi = Math.sin( this.phi );
-			var cosPhi = Math.cos( this.phi );
-			var sinTheta = Math.sin( this.theta );
-			var cosTheta = Math.cos( this.theta );
-
-			return new THREE.Vector3(
-				this.radius * sinPhi * cosTheta,
-				this.radius * sinPhi * sinTheta,
-				this.radius * cosPhi );
-
-		}
 	}
+
 };
 
 

+ 0 - 20
src/math/distributions/CosineSphericalDistribution.js

@@ -1,20 +0,0 @@
-/**
- * @author abelnation / https://github.com/abelnation
- */
-
-THREE.CosineSphericalDistribution = function () {
-
-	var oneOverPi = 1.0 / Math.PI;
-
-	THREE.SphericalDistribution.call( this, function( pos ) {
-
-		// see: Real-Time Polygonal-Light Shading with Linearly Transformed Cosines
-		//      Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt
-		//      https://eheitzresearch.wordpress.com/415-2/
-		return oneOverPi * Math.max( 0, pos.z );
-
-	} );
-}
-
-THREE.CosineSphericalDistribution.prototype = Object.create( THREE.SphericalDistribution.prototype );
-THREE.CosineSphericalDistribution.prototype.constructor = THREE.CosineSphericalDistribution;

+ 0 - 92
src/math/distributions/LinearlyTransformedSphericalDistribution.js

@@ -1,92 +0,0 @@
-/**
- * @author abelnation / https://github.com/abelnation
- */
-
-THREE.LinearlyTransformedSphericalDistribution = function( distributionFn, transformMat4 ) {
-
-	THREE.SphericalDistribution.call( this, distributionFn );
-
-	this.transformMat4 = transformMat4 || new THREE.Matrix4();
-	this.transformMat3 = new THREE.Matrix3();
-	this.updateTransform();
-}
-
-// inherit from SphericalDistribution
-THREE.LinearlyTransformedSphericalDistribution.prototype =
-	Object.create( THREE.SphericalDistribution.prototype );
-THREE.LinearlyTransformedSphericalDistribution.prototype.constructor =
-	THREE.LinearlyTransformedSphericalDistribution;
-
-// Overridden methods
-THREE.LinearlyTransformedSphericalDistribution.prototype.valueAtNormalizedPosVec3 = function ( pos ) {
-
-	var transformedPos = pos.clone().applyMatrix3( this.transformInverseMat3 );
-	var transformedPosMag = transformedPos.length();
-
-	// normalize with length (calling normalize would recalculate length)
-	transformedPos.divideScalar(transformedPosMag);
-
-	var distFnValue;
-	if (this.distributionFn instanceof THREE.SphericalDistribution) {
-
-		distFnValue = this.distributionFn.valueAtNormalizedPosVec3( transformedPos );
-
-	} else if (typeof this.distributionFn === 'function') {
-
-		distFnValue = this.distributionFn( transformedPos );
-
-	}
-
-	var angleScalarValue = ( this.transformInverseDet / Math.pow( transformedPosMag, 3 ) );
-	var result = distFnValue * angleScalarValue;
-
-	return result;
-
-}
-
-THREE.LinearlyTransformedSphericalDistribution.prototype.updateTransform = function() {
-
-	this.transformMat3.setFromMatrix4( this.transformMat4 );
-	this.transformInverseMat3 = this.transformMat3.getInverse(this.transformMat3, true);
-	this.transformInverseDet = this.transformInverseMat3.determinant();
-
-}
-
-THREE.LinearlyTransformedSphericalDistribution.prototype.scale = function ( x, y, z ) {
-
-	var scale = new THREE.Matrix4().makeScale( x, y, z );
-	this.transformMat4.multiply( scale );
-	this.updateTransform();
-
-	return this;
-
-}
-
-THREE.LinearlyTransformedSphericalDistribution.prototype.rotate = function ( rx, ry, rz ) {
-
-	var rot = new THREE.Matrix4().makeRotationFromEuler( new THREE.Euler( rx, ry, rz ) );
-	this.transformMat4.multiply( rot );
-	this.updateTransform();
-
-	return this;
-
-}
-
-THREE.LinearlyTransformedSphericalDistribution.prototype.shear = function ( x, y, z ) {
-
-	var shear = new THREE.Matrix4().makeShear( x, y, z );
-	this.transformMat4.multiply( shear );
-	this.updateTransform();
-
-	return this;
-
-}
-
-THREE.LinearlyTransformedSphericalDistribution.prototype.transformMat4 = function ( mat4 ) {
-
-	this.transformMat4 = mat4.clone();
-	this.updateTransform();
-
-	return this;
-
-}

+ 0 - 50
src/math/distributions/SphericalDistribution.js

@@ -1,50 +0,0 @@
-/**
- * @author abelnation / https://github.com/abelnation
- */
-
-THREE.SphericalDistribution = function ( distributionFn ) {
-
-	this.distributionFn = distributionFn;
-	this.radius = 1.0;
-
-	this.sphere = new THREE.Sphere( new THREE.Vector3(), this.radius );
-
-};
-
-THREE.SphericalDistribution.prototype = {
-	constructor: THREE.SphericalDistribution,
-
-	valueAtNormalizedPosVec3: function ( normalizedPos ) {
-
-		if (this.distributionFn instanceof THREE.SphericalDistribution) {
-
-			return this.distributionFn.valueAtNormalizedPosVec3( normalizedPos );
-
-		} else if (typeof this.distributionFn === 'function') {
-
-			return this.distributionFn( normalizedPos );
-
-		}
-
-	},
-
-	valueAtPosVec3: function ( pos ) {
-
-		var normalized = this.sphere.clampPoint( pos );
-		return this.valueAtNormalizedPosVec3( normalized );
-
-	},
-
-	valueAtPos: function ( x, y, z ) {
-
-		return this.valueAtPosVec3( new THREE.Vector3( x, y, z ) )
-
-	},
-
-	valueAtSphericalPos: function ( phi, theta ) {
-
-		var spherical = new THREE.Spherical( this.radius, phi, theta );
-		return this.valueAtPosVec3( spherical.getCartesian() );
-
-	}
-};