Problem about rotating a primitive

Hi,
I have added a primitive to scene(looks like part of ellipsoidoutline), and I can rotate it around z-axis by using Matrix3.fromRotationZ. Now I want to rotate it around center point up and down with the border-top(border-bottom) parallel to xy plane, what should I do?

The following code is the modelMatrix used to rotate it around z-axis:

var rotMatrix = new Cesium.Matrix3.fromRotationZ(heading);

var modelMatrix = Cesium.Matrix4.multiply(

Cesium.Transforms.eastNorthUpToFixedFrame(centerPosition),

Cesium.Matrix4.fromRotationTranslation(rotMatrix, new Cesium.Cartesian3(0.0, 0.0, 0.0)),

new Cesium.Matrix4()

);

Thanks!

Hello,

Sounds like you will probably want to use a Quaternion. You can use the functions Quaternion.fromAxisAngle or Quaternion.fromHeadingPitchRoll to get the quaternion, then you can use Matrix3.fromQuaternion to convert the quaternion to a rotation matrix.

Best,

Hannah

Thanks Hannah, Cesium.Quaternion.fromHeadingPitchRoll works well!

在 2016年11月15日星期二 UTC+8上午12:03:13,Hannah Pinkos写道: