2017-07-05 56 views

回答

0

如果我給你正確的,那麼:

var angle = Math.PI/4; // rotate 45 deg CCW, negative angle is CW 
var m = new THREE.Matrix4(); 
m.set(
    Math.cos(angle), Math.sin(angle), 0, 0, 
    -Math.sin(angle), Math.cos(angle), 0, 0, 
    0    , 0    , 1, 0, 
    0    , 0    , 0, Math.sqrt(2) // diagonal length is square root of 2 times of side length 
); 

var originals = [ 
    new THREE.Vector3(-1, 1, 0), 
    new THREE.Vector3(1, 1, 0), 
    new THREE.Vector3(-1, -1, 0), 
    new THREE.Vector3(1, -1, 0) 
]; 

function applyMatrix(points, matrix4){ 
    var result = []; 
    points.forEach((point)=>{ 
    result.push(point.clone().applyMatrix4(matrix4)); 
    }) 
    return result; 
} 

var images = applyMatrix(originals, m); 

jsfiddle例如R86

PS的解決方案是非常適合你的照片給了什麼。

+0

是的,這是正確的,謝謝 –

相關問題