populateMatrix 方法在 OrientationSensor interface populates the given target matrix with the rotation matrix based on the latest sensor reading. The rotation matrix is shown below.

The formulas used to convert the sensor's quaternion to the provided matrix.

其中:

  • W = cos(θ/2)
  • X = Vx * sin(θ/2)
  • Y = Vy * sin(θ/2)
  • Z = Vz * sin(θ/2)

If a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions.

句法

orientationInstance.populateMatrix(targetMatrix)
					

因为 OrientationSensor is a base class, populateMatrix may only be read from one of its derived classes.

参数

targetMatrix

TBD

返回值

undefined

范例

// TBD
					

规范

规范 状态 注释
Orientation Sensor
The definition of 'populateMatrix' in that specification.
候选推荐 初始定义。

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
populateMatrix Chrome 69 Edge ≤79 Firefox ? IE ? Opera 56 Safari ? WebView Android 69 Chrome Android 69 Firefox Android ? Opera Android 48 Safari iOS ? Samsung Internet Android 10.0

图例

完整支持

完整支持

兼容性未知 ?

兼容性未知

元数据

  • 最后修改:
  1. OrientationSensor
  2. 特性
    1. quaternion
  3. 方法
    1. populateMatrix()
  4. 继承:
    1. 传感器
    2. EventTarget