UNPKG

1.21 kBTypeScriptView Raw
1import { point3 } from './type.d';
2
3/**
4 * 矩阵对象
5 */
6export interface matrix4 {
7
8 /**
9 * 返回matrix4当前记录的内部矩阵
10 */
11 value(),
12
13 /**
14 * 二个矩阵相乘
15 * @param newMatrix4 矩阵对象
16 * @param flag 可选,默认false,表示左乘,即newMatrix4 × matrix4,如果设置true,表示右乘
17 */
18 multiply(newMatrix4: matrix4, flag?: boolean): matrix4,
19
20 /**
21 * 把变换矩阵作用在具体的点上
22 */
23 use(x: number, y: number, z: number, w: number): point3,
24
25 /**
26 * 沿着向量(a, b, c)方向移动距离dis(其中c可以不传,默认0)
27 */
28 move(dis: number, a: number, b: number, c: number): matrix4,
29
30 /**
31 * 以点(cx, cy, cz)为中心,分别在x、y和z方向上缩放xTimes、yTimes和zTimes倍(其中cx、cy和cz都可以不传递,默认0)
32 */
33 scale(xTimes: number, yTimes: number, zTimes: number, cx: number, cy: number, cz: number): matrix4,
34
35 /**
36 * 围绕射线(a1, b1, c1) -> (a2, b2, c2)旋转deg度(方向由右手法则确定)
37 */
38 rotate(deg?: number, a1?: number, b1?: number, c1?: number, a2?: number, b2?: number, c2?: number): matrix4,
39
40}