前文代码中有如下;矩阵乘以旋转大小,还放入mat;
Cesium.Matrix4.multiply(mat, rotationX, mat);
初看以为rotationX是一个数值,因为矩阵可以和数相乘;
但是看它的代码,rotationX是由一长串代码获得的;下面来看一下;
Cesium.Ion.defaultAccessToken = 'xxxxxx'
var viewer = new Cesium.Viewer("cesiumContainer");
var rotationX = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians
(2)));
alert("Rotation: "+rotationX);
rotationX还是一个矩阵;
调用了3个类的函数,最终获得这个矩阵;
radian
n:弧度,弪
Cesium.Math.toRadians,这是把数值转换为弧度;
Cesium.Matrix4,看上去应该是4*4矩阵,看一下定义,
new Cesium.Matrix4(column0Row0, column1Row0, column2Row0, column3Row0, column0Row1, column1Row1, column2Row1, column3Row1, column0Row2, column1Row2, column2Row2, column3Row2, column0Row3, column1Row3, column2Row3, column3Row3)
没错是4*4矩阵;
Cesium.Matrix3是3*3矩阵;
new Cesium.Matrix3(column0Row0, column1Row0, column2Row0, column0Row1, column1Row1, column2Row1, column0Row2, column1Row2, column2Row2)