File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,8 +76,16 @@ var Vector2 = new Class({
7676
7777 scale : function ( value )
7878 {
79- this . x *= value ;
80- this . y *= value ;
79+ if ( isFinite ( value ) )
80+ {
81+ this . x *= value ;
82+ this . y *= value ;
83+ }
84+ else
85+ {
86+ this . x = 0 ;
87+ this . y = 0 ;
88+ }
8189
8290 return this ;
8391 } ,
Original file line number Diff line number Diff line change @@ -28,6 +28,22 @@ var Vector3 = new Class({
2828 return new Vector3 ( this . x , this . y , this . z ) ;
2929 } ,
3030
31+ crossVectors : function ( a , b )
32+ {
33+ var ax = a . x ;
34+ var ay = a . y ;
35+ var az = a . z ;
36+ var bx = b . x ;
37+ var by = b . y ;
38+ var bz = b . z ;
39+
40+ this . x = ay * bz - az * by ;
41+ this . y = az * bx - ax * bz ;
42+ this . z = ax * by - ay * bx ;
43+
44+ return this ;
45+ } ,
46+
3147 copy : function ( src )
3248 {
3349 this . x = src . x ;
@@ -84,9 +100,18 @@ var Vector3 = new Class({
84100
85101 scale : function ( scale )
86102 {
87- this . x *= scale ;
88- this . y *= scale ;
89- this . z *= scale ;
103+ if ( isFinite ( scale ) )
104+ {
105+ this . x *= scale ;
106+ this . y *= scale ;
107+ this . z *= scale ;
108+ }
109+ else
110+ {
111+ this . x = 0 ;
112+ this . y = 0 ;
113+ this . z = 0 ;
114+ }
90115
91116 return this ;
92117 } ,
You can’t perform that action at this time.
0 commit comments