-
Notifications
You must be signed in to change notification settings - Fork 4
/
IQuaternion.ts
75 lines (66 loc) · 2.15 KB
/
IQuaternion.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import {TypedArray} from '../../types/CommonTypes';
import {IVector3, IMutableVector3} from './IVector';
import {IMatrix44} from './IMatrix';
export interface IQuaternion {
readonly className: string;
_v: Float32Array;
readonly x: number;
readonly y: number;
readonly z: number;
readonly w: number;
toString(): string;
toStringApproximately(): string;
flattenAsArray(): Array<number>;
isDummy(): boolean;
isEqual(vec: IQuaternion, delta?: number): boolean;
isStrictEqual(vec: IQuaternion): boolean;
at(i: number): number;
length(): number;
lengthSquared(): number;
dot(vec: IQuaternion): number;
toEulerAnglesTo(out: IMutableVector3): IMutableVector3;
clone(): IQuaternion;
}
export interface IMutableQuaternion extends IQuaternion {
readonly className: string;
x: number;
y: number;
z: number;
w: number;
// common with immutable quaternion
toString(): string;
toStringApproximately(): string;
flattenAsArray(): Array<number>;
isDummy(): boolean;
isEqual(vec: IQuaternion, delta?: number): boolean;
isStrictEqual(vec: IQuaternion): boolean;
at(i: number): number;
length(): number;
lengthSquared(): number;
dot(vec: IQuaternion): number;
toEulerAnglesTo(out: IMutableVector3): IMutableVector3;
clone(): IMutableQuaternion;
// only for mutable quaternion
raw(): TypedArray;
setAt(i: number, value: number): IMutableQuaternion;
setComponents(x: number, y: number, z: number, w: number): IMutableQuaternion;
copyComponents(quat: IQuaternion): IMutableQuaternion;
identity(): IMutableQuaternion;
normalize(): IMutableQuaternion;
axisAngle(vec: IVector3, radian: number): IMutableQuaternion;
fromMatrix(mat: IMatrix44): IMutableQuaternion;
add(quat: IQuaternion): IMutableQuaternion;
subtract(quat: IQuaternion): IMutableQuaternion;
multiply(quat: IQuaternion): IMutableQuaternion;
multiplyNumber(value: number): IMutableQuaternion;
divideNumber(value: number): IMutableQuaternion;
clone(): IMutableQuaternion;
}
export interface ILogQuaternion {
readonly className: string;
readonly _v: Float32Array;
readonly x: number;
readonly y: number;
readonly z: number;
readonly w: number;
}