256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
//
// equation at:
// http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html
// creates a rotation matrix about the given vector.
//
function vector_rotation(vector, s){
if(!vector) throw "vector argument to vector_rotation missing";
if(!s) throw "angle argument to vector_rotation missing";
var len = Math.sqrt(vector[0]*vector[0]
+ vector[1]*vector[1]
+ vector[2]*vector[2]);
var u = vector[0]/len;
var v = vector[1]/len;
|
|
|
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
|
//
// equation at:
// http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html
// creates a rotation matrix about the given vector.
//
function vector_rotation(vector, s){
if(!vector) throw "vector argument to vector_rotation missing";
if(s === null || s === undefined) throw "angle argument to vector_rotation missing";
var len = Math.sqrt(vector[0]*vector[0]
+ vector[1]*vector[1]
+ vector[2]*vector[2]);
var u = vector[0]/len;
var v = vector[1]/len;
|