Google cardBoard Android API (十二):HeadTransform

20 篇文章 0 订阅
18 篇文章 0 订阅
public class HeadTransform

Describes the head transform independently of any eye parameters.

Public Constructors

Public Methods

void
getEulerAngles(float[] eulerAngles, int offset)
void
getForwardVector(float[] forward, int offset)
void
getHeadView(float[] headView, int offset)
void
getQuaternion(float[] quaternion, int offset)
void
getRightVector(float[] right, int offset)
void
getTranslation(float[] translation, int offset)
void
getUpVector(float[] up, int offset)

Inherited Methods

Public Constructors

public HeadTransform ()

Public Methods

public void getEulerAngles (float[] eulerAngles, int offset)

Provides the Euler angles representation of the head rotation.

Use of Euler angles is discouraged as they might be subject to Gimbal lock situations. Use quaternions or rotation matrices instead whenever possible.

The provided values represent the viewport rotation as pitch, yaw and roll angles where the matrix R = Rz(roll) * Rx(pitch) * Ry(yaw) represents the full rotation. This rotation matrix order ensures both yaw and roll are in the full [-pi, pi] interval.

The angles are provided in radians, in this order and within the following intervals:

  • Pitch (X axis): [-pi/2, pi/2]
  • Yaw (Y axis): [-pi, pi]
  • Roll (Z axis): [-pi, pi]

The X-Y-Z axes are the basis of a right-handed OpenGL-style coordinate system. During Gimbal lock this method enforces yaw to 0 and provides a valid roll angle.

Parameters
eulerAngles Array where the 3 angles will be written to.
offset Offset in the array where data should be written.
Throws
IllegalArgumentException If there is not enough space to write the result.
public void getForwardVector (float[] forward, int offset)

Provides the direction the head is looking towards as a 3x1 unit vector.

Note that in OpenGL the forward vector points into the -Z direction. Make sure to invert it if ever used to compute the basis of a right-handed system.

Parameters
forward Array where the forward vector will be written to.
offset Offset in the array where data should be written.
Throws
IllegalArgumentException If there is not enough space to write the result.
public void getHeadView (float[] headView, int offset)

A matrix representing the transform from the camera to the head.

Head origin is defined as the center point between the two eyes.

Parameters
headView Array where the 4x4 column-major transformation matrix will be written to.
offset Offset in the array where data should be written.
Throws
IllegalArgumentException If there is not enough space to write the result.
public void getQuaternion (float[] quaternion, int offset)

Provides the quaternion representing the head rotation.

Parameters
quaternion Array where the quaternion (x, y, z, w) will be written to.
offset Offset in the array where data should be written.
Throws
IllegalArgumentException If there is not enough space to write the result.
public void getRightVector (float[] right, int offset)

Provides the rightwards direction of the head as a 3x1 unit vector.

Parameters
right Array where the right vector will be written to.
offset Offset in the array where data should be written.
Throws
IllegalArgumentException If there is not enough space to write the result.
public void getTranslation (float[] translation, int offset)

Provides the relative translation of the head as a 3x1 vector.

Parameters
translation Array where the translation vector will be written to.
offset Offset in the array where data should be written.
Throws
IllegalArgumentException If there is not enough space to write the result.
public void getUpVector (float[] up, int offset)

Provides the upwards direction of the head as a 3x1 unit vector.

Parameters
up Array where the up vector will be written to.
offset Offset in the array where data should be written.
Throws
IllegalArgumentException If there is not enough space to write the result.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值