Class: Euler
欧拉角描述一个旋转变换,通过指定轴顺序和其各个轴向上的指定旋转角度来旋转一个物体
const a = new Euler(0, 1, 1.57, 'xyz' )
Hierarchy
-
default
↳
Euler
Table of contents
Constructors
Properties
Accessors
Methods
- fromObject
- toObject
- fromRotationMatrix
- fromQuaternion
- fromVector3
- toQuaternion
- toVector3
- set
- clone
- copy
- equals
- onChange
- triggerChange
- toString
- fromArray
- toArray
Constructors
constructor
• new Euler(x?
, y?
, z?
, order?
): Euler
Parameters
Name | Type | Default value | Description |
---|---|---|---|
x | number | 0 | 用弧度表示x轴旋转量,默认值是 0 |
y | number | 0 | 用弧度表示y轴旋转量,默认值是 0 |
z | number | 0 | 用弧度表示z轴旋转量,默认值是 0 |
order | ANGLE_ORDER | 'xyz' | 表示旋转顺序的字符串,默认为'xyz' |
Returns
Overrides
Vector.constructor
Defined in
Properties
elements
• elements: Float32Array
| Float64Array
Overrides
Vector.elements
Defined in
Accessors
x
• get
x(): number
获取 x 值
Returns
number
number;
Defined in
• set
x(x
): void
设置 x 值
Parameters
Name | Type |
---|---|
x | number |
Returns
void
Defined in
y
• get
y(): number
获取 y 值
Returns
number
number;
Defined in
• set
y(y
): void
设置 y 值
Parameters
Name | Type |
---|---|
y | number |
Returns
void
Defined in
z
• get
z(): number
获取 z 值
Returns
number
number;
Defined in
• set
z(z
): void
设置 z 值
Parameters
Name | Type |
---|---|
z | number |
Returns
void
Defined in
order
• get
order(): ANGLE_ORDER
获取旋转顺序
Returns
ANGLE_ORDER
Defined in
• set
order(order
): void
设置旋转顺序
Parameters
Name | Type |
---|---|
order | ANGLE_ORDER |
Returns
void
Defined in
roll
• get
roll(): number
Returns
number
Defined in
• set
roll(roll
): void
Parameters
Name | Type |
---|---|
roll | number |
Returns
void
Defined in
pitch
• get
pitch(): number
Returns
number
Defined in
• set
pitch(pitch
): void
Parameters
Name | Type |
---|---|
pitch | number |
Returns
void
Defined in
yaw
• get
yaw(): number
Returns
number
Defined in
• set
yaw(yaw
): void
Parameters
Name | Type |
---|---|
yaw | number |
Returns
void
Defined in
Methods
fromObject
▸ fromObject(«destructured»
): Euler
从对象创建欧拉角
Parameters
Name | Type |
---|---|
«destructured» | Object |
› x | any |
› y | any |
› z | any |
› order | any |
Returns
Defined in
toObject
▸ toObject(): Object
转换到对象
Returns
Object
Name | Type |
---|---|
x | number |
y | number |
z | number |
order | ANGLE_ORDER |
Defined in
fromRotationMatrix
▸ fromRotationMatrix(m
, order?
, update?
): Euler
从 Matrix4 创建欧拉角
Parameters
Name | Type | Default value |
---|---|---|
m | Matrix4 | undefined |
order | ANGLE_ORDER | undefined |
update | boolean | true |
Returns
Defined in
fromQuaternion
▸ fromQuaternion(q
): Euler
从四元数创建欧拉角
Parameters
Name | Type |
---|---|
q | Quaternion |
Returns
Defined in
fromVector3
▸ fromVector3(vec3
, order?
): Euler
从 Vector3 创建欧拉角
Parameters
Name | Type |
---|---|
vec3 | any |
order | ANGLE_ORDER |
Returns
Defined in
toQuaternion
▸ toQuaternion(): Quaternion
转换到四元数
Returns
Defined in
toVector3
▸ toVector3(): Vector3
转换到 Vector3
Returns
Defined in
set
▸ set(x
, y
, z
, order?
): Euler
设置欧拉角的 x、y、z、order
Parameters
Name | Type |
---|---|
x | any |
y | any |
z | any |
order | ANGLE_ORDER |
Returns
Defined in
clone
▸ clone(): Euler
克隆此欧拉角对象
Returns
Defined in
copy
▸ copy(euler
): Euler
将传入的 euler 的各数值复制到此欧拉角
Parameters
Name | Type |
---|---|
euler | Euler |
Returns
Defined in
equals
▸ equals(e
): boolean
判断两个欧拉角是否相同
Parameters
Name | Type |
---|---|
e | Euler |
Returns
boolean
Defined in
onChange
▸ onChange(cb
): void
监听欧拉角变更
Parameters
Name | Type | Description |
---|---|---|
cb | ICallback | 回调函数 |
Returns
void
Defined in
triggerChange
▸ triggerChange(): void
触发所有的回调函数
Returns
void
Defined in
toString
▸ toString(): string
转换为字符串
Returns
string
Defined in
fromArray
▸ fromArray(array
, offset?
): Euler
从数组构建向量数据
Parameters
Name | Type | Default value | Description |
---|---|---|---|
array | any | undefined | 原始数组 |
offset | number | 0 | 数组偏移量 |
Returns
Inherited from
Vector.fromArray
Defined in
toArray
▸ toArray(out?
, offset?
): Float32Array
| Float64Array
| number
[]
从向量转换到数组
Parameters
Name | Type | Default value | Description |
---|---|---|---|
out | Float32Array | Float64Array | number [] | [] | 输出数据 |
offset | number | 0 | 偏移量 |
Returns
Float32Array
| Float64Array
| number
[]
Inherited from
Vector.toArray