Skip to content

Commit

Permalink
three.js: updated builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Feb 15, 2013
1 parent ada351a commit 7207a1c
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 1 deletion.
124 changes: 124 additions & 0 deletions three.js/build/three.js
Expand Up @@ -2656,6 +2656,130 @@ THREE.extend( THREE.Vector4.prototype, {
* @author bhouston / http://exocortex.com
*/

THREE.Line3 = function ( start, end ) {

this.start = ( start !== undefined ) ? start : new THREE.Vector3();
this.end = ( end !== undefined ) ? end : new THREE.Vector3();

};

THREE.extend( THREE.Line3.prototype, {

set: function ( start, end ) {

this.start.copy( start );
this.end.copy( end );

return this;

},

copy: function ( line ) {

this.start.copy( line.start );
this.end.copy( line.end );

return this;

},

center: function ( optionalTarget ) {

var result = optionalTarget || new THREE.Vector3();
return result.addVectors( this.start, this.end ).multiplyScalar( 0.5 );

},

delta: function ( optionalTarget ) {

var result = optionalTarget || new THREE.Vector3();
return result.subVectors( this.end, this.start );

},

distanceSq: function () {

return this.start.distanceToSquared( this.end );

},

distance: function () {

return this.start.distanceTo( this.end );

},

at: function ( t, optionalTarget ) {

var result = optionalTarget || new THREE.Vector3();

return this.delta( result ).multiplyScalar( t ).add( this.start );

},

closestPointToPointParameter: function() {

var startP = new THREE.Vector3();
var startEnd = new THREE.Vector3();

return function ( point, clampToLine ) {

startP.subVectors( point, this.start );
startEnd.subVectors( this.end, this.start );

var startEnd2 = startEnd.dot( startEnd );
var startEnd_startP = startEnd.dot( startP );

var t = startEnd_startP / startEnd2;

if( clampToLine ) {

t = THREE.Math.clamp( t, 0, 1 );

}

return t;

};

}(),

closestPointToPoint: function ( point, clampToLine, optionalTarget ) {

var t = this.closestPointToPointParameter( point, clampToLine );

var result = optionalTarget || new THREE.Vector3();

return this.delta( result ).multiplyScalar( t ).add( this.start );

},

applyMatrix4: function ( matrix ) {

this.start.applyMatrix4( matrix );
this.end.applyMatrix4( matrix );

return this;

},

equals: function ( line ) {

return line.start.equals( this.start ) && line.end.equals( this.end );

},

clone: function () {

return new THREE.Line3().copy( this );

}

} );
/**
* @author bhouston / http://exocortex.com
*/

THREE.Box2 = function ( min, max ) {

this.min = ( min !== undefined ) ? min : new THREE.Vector2( Infinity, Infinity );
Expand Down
5 changes: 4 additions & 1 deletion three.js/build/three.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7207a1c

Please sign in to comment.