base/quaternion
쿼터니언. (3차원 회전, 골격 애니메이션 보간의 기본 단위)
Quaternion. (3D rotation, the basic unit of skeletal animation interpolation)
Quaternionextends Object
쿼터니언. (3차원 회전, 골격 애니메이션 보간의 기본 단위)
Quaternion. (3D rotation, the basic unit of skeletal animation interpolation)
import { Quaternion, Matrix4 } from "./build/vanilla.js";
const start = Quaternion.identity();
const end = Quaternion.createFromEuler(0, Math.PI / 2, 0);
const halfway = Quaternion.slerp(start, end, 0.5);
console.log(halfway.x, halfway.y, halfway.z, halfway.w);
const rotation = Matrix4.createRotationFromQuaternion(halfway);
const direction = rotation.transformDirection(0, 0, 1);
console.log(direction.x, direction.y, direction.z);생성.
Constructor.
생성. (정적)
Creates. (static)
- xnumber
- X 성분.X component.
- ynumber
- Y 성분.Y component.
- znumber
- Z 성분.Z component.
- wnumber
- W 성분.W component.
반환ReturnsQuaternion 새 쿼터니언.A new quaternion.
짝Counterpart: vanilla-engine Quaternion.create
단위 쿼터니언 생성. (정적)
Creates an identity quaternion. (static)
반환ReturnsQuaternion 회전이 없는 (0, 0, 0, 1) 쿼터니언.A (0, 0, 0, 1) quaternion with no rotation.
짝Counterpart: vanilla-engine Quaternion.identity
오일러 각으로 생성. (정적, XYZ 순서 라디안)
Creates from Euler angles. (static, XYZ order, radians)
- xRadiannumber
- X 축 회전. (라디안)Rotation around the X axis. (radians)
- yRadiannumber
- Y 축 회전. (라디안)Rotation around the Y axis. (radians)
- zRadiannumber
- Z 축 회전. (라디안)Rotation around the Z axis. (radians)
반환ReturnsQuaternion 회전 쿼터니언.Rotation quaternion.
짝Counterpart: vanilla-engine Quaternion.create_from_euler
구면 선형 보간. (정적, 최단 경로)
Spherical linear interpolation. (static, shortest path)
- fromQuaternion
- 시작 회전.Start rotation.
- toQuaternion
- 끝 회전.End rotation.
- normalizedTimenumber
- 0 이면 from, 1 이면 to.0 gives from, 1 gives to.
반환ReturnsQuaternion 보간해 정규화한 새 쿼터니언. (짧은 쪽으로 돈다)A new interpolated and normalized quaternion. (takes the shorter path)
짝Counterpart: vanilla-engine Quaternion.slerp
X 성분 반환 프로퍼티. X 성분 설정 프로퍼티.
X component getter property. X component setter property.
반환Returnsnumber X 성분.X component.
짝Counterpart: vanilla-engine Quaternion.x
Y 성분 반환 프로퍼티. Y 성분 설정 프로퍼티.
Y component getter property. Y component setter property.
반환Returnsnumber Y 성분.Y component.
짝Counterpart: vanilla-engine Quaternion.y
Z 성분 반환 프로퍼티. Z 성분 설정 프로퍼티.
Z component getter property. Z component setter property.
반환Returnsnumber Z 성분.Z component.
짝Counterpart: vanilla-engine Quaternion.z
W 성분 반환 프로퍼티. W 성분 설정 프로퍼티.
W component getter property. W component setter property.
반환Returnsnumber W 성분.W component.
짝Counterpart: vanilla-engine Quaternion.w
대입.
Assignment.
- xnumber
- X 성분.X component.
- ynumber
- Y 성분.Y component.
- znumber
- Z 성분.Z component.
- wnumber
- W 성분.W component.
짝Counterpart: vanilla-engine Quaternion.set
정규화.
Normalize.
반환ReturnsQuaternion 길이를 1 로 맞춘 새 쿼터니언. (길이가 0 이면 단위 쿼터니언)A new quaternion scaled to length 1. (identity if the length is 0)
짝Counterpart: vanilla-engine Quaternion.normalize
곱하기. (this 회전 뒤에 other 회전을 로컬로 누적)
Multiply. (Accumulates the other rotation locally after this rotation)
- otherQuaternion
- 뒤에 이을 회전.Rotation to apply after.
반환ReturnsQuaternion 두 회전을 합친 새 쿼터니언. (this × other)A new quaternion combining both rotations. (this × other)
짝Counterpart: vanilla-engine Quaternion.multiply