File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -316,14 +316,6 @@ var Vector3 = new Class({
316316 var viewWidth = viewport . z ;
317317 var viewHeight = viewport . w ;
318318
319- // var x = this.x;
320- // var y = this.y;
321- // var z = this.z;
322-
323- // x = x - viewX;
324- // y = viewHeight - y - 1;
325- // y = y - viewY;
326-
327319 var x = this . x - viewX ;
328320 var y = ( viewHeight - this . y - 1 ) - viewY ;
329321 var z = this . z ;
@@ -335,17 +327,18 @@ var Vector3 = new Class({
335327 return this . project ( invProjectionView ) ;
336328 } ,
337329
338- random : function ( scale )
330+ // Position Vector randomly in a spherical area defined by the given radius
331+ random : function ( radius )
339332 {
340- if ( scale === undefined ) { scale = 1 ; }
333+ if ( radius === undefined ) { radius = 1 ; }
341334
342335 var r = Math . random ( ) * 2 * Math . PI ;
343336 var z = ( Math . random ( ) * 2 ) - 1 ;
344- var zScale = Math . sqrt ( 1 - z * z ) * scale ;
337+ var zScale = Math . sqrt ( 1 - z * z ) * radius ;
345338
346339 this . x = Math . cos ( r ) * zScale ;
347340 this . y = Math . sin ( r ) * zScale ;
348- this . z = z * scale ;
341+ this . z = z * radius ;
349342
350343 return this ;
351344 } ,
You can’t perform that action at this time.
0 commit comments