• threejs两个向量旋转 一个向量绕零一个向量旋转一个角度后的向量计算


    threejs向量旋转

    threejs一个向量绕另一个向量旋转

    threejs向量变换

    var v3 = new THREE.Vector3(0,1,1);
    var v1 = new THREE.Vector3(1,0,0);
    var v2 = new THREE.Vector3(1,1,0);
    var v4 = new THREE.Vector3(0,0,1);
    var angle1 = v1.angleTo(v2);  //
    var angle2 = v2.angleTo(v1);  //
    
    console.log(angle1);
    console.log(angle2);
    
    
    var v32 = v3.cross(v2);
    console.log( v1.x + ' ' + v1.y + ' ' + v1.z );
    console.log( v2.x + ' ' + v2.y + ' ' + v2.z );
    console.log( v3.x + ' ' + v3.y + ' ' + v3.z );
    console.log(v32);
    
    var t1 = v1.normalize();
    console.log(t1);
    
    var t2 = v1.angleTo(v2);
    console.log(t2);
    
    var v12 = v1.cross(v4);
    console.log(v12);
    0.7853981633974484
    0.7853981633974484
    175 1 0 0
    176 1 1 0
    177 -1 1 -1
    Vector3 {x: -1, y: 1, z: -1}
    Vector3 {x: 1, y: 0, z: 0}
    0.7853981633974484
    Vector3 {x: 0, y: -1, z: 0}

    threejs一个向量绕零一个向量旋转一个角度后的向量计算

    var v_3 = new THREE.Vector3(1,0,0);
    var v_4 = new THREE.Vector3(0,0,1);
    
    var v_34 = v_3.applyAxisAngle(v_4,45.0 * Math.PI / 180.0);
    console.log(v_34);
    console.log(Math.round((v_34.x + Number.EPSILON) * 100) / 100);
    {
        "x": 0.7071067811865475,
        "y": 0.7071067811865476,
        "z": 0
    }

    ######################

  • 相关阅读:
    POJ 3160 Father Christmas flymouse (tarjan+spfa)
    HDU 1133 Buy the Ticket
    Problem F: [USACO 3.1.6]邮票
    无向图 割点模板 (转载)
    POJ 2117 Electricity (割点)
    HDU 4337 King Arthur's Knights
    Delphi2010中保存UTF8/Unicode编码文件的问题
    Delphi的泛型学习
    关于Ehlib5中的DBGridEh使用问题
    delphi中的命名空间
  • 原文地址:https://www.cnblogs.com/herd/p/16319084.html
Copyright © 2020-2023  润新知