zoukankan      html  css  js  c++  java
  • CESIUM空间中AB两点A绕B点的地面法向量旋转任意角度后新的A点坐标(A’)

    var A = new Cesium.Cartesian3(675679.994355399, 4532763.148054989, 4426298.210847025);
    var B = new Cesium.Cartesian3(675520.4303984543, 4532803.837842555, 4425994.113846752);
     
     
    // 计算B的地面法向量
    var chicB = Cesium.Cartographic.fromCartesian(B);
    chicB.height = 0;
    var dB = Cesium.Cartographic.toCartesian(chicB);
    var normaB = Cesium.Cartesian3.normalize(Cesium.Cartesian3.subtract(dB, B, new Cesium.Cartesian3()), new Cesium.Cartesian3());
     
    // 构造基于B的法向量旋转90度的矩阵
    var Q = Cesium.Quaternion.fromAxisAngle(normaB, Cesium.Math.toRadians(90));
    var m3 = Cesium.Matrix3.fromQuaternion(Q);
    var m4 = Cesium.Matrix4.fromRotationTranslation(m3);
     
    // 计算A点相对B点的坐标A1
    var A1 = Cesium.Cartesian3.subtract(A, B, new Cesium.Cartesian3());
     
    //对A1应用旋转矩阵
    var p = Cesium.Matrix4.multiplyByPoint(m4, A1, new Cesium.Cartesian3());
    // 新的A的坐标
    var p2 = Cesium.Cartesian3.add(p, B, new Cesium.Cartesian3());
     
    viewer.entities.add({
        polyline: {
            positions: [B, A],
             5,
            material: Cesium.Color.RED
        },
    });
     
     
    viewer.entities.add({
        polyline: {
            positions: [B, p2],
             5,
            material: Cesium.Color.BLUE
        },
     
    });
    

      

  • 相关阅读:
    scan design rules
    scan cell
    DFT basics
    测试性分析
    DFT设计绪论
    clock gate cell
    Linux命令
    Multi-voltage和power gating的实现
    Power Gating的设计(架构)
    Power Gating的设计(模块二)
  • 原文地址:https://www.cnblogs.com/fengyingwang/p/14028744.html
Copyright © 2011-2022 走看看