add mat4.decompose
This commit is contained in:
@@ -9,6 +9,7 @@ Most functions have several options for argument lists (overloads).
|
||||
Type conventions will be used on this page.
|
||||
- vector - an array of three or four numbers
|
||||
- vec3 - array of three numbers
|
||||
- vec4 - array of four numbers
|
||||
- matrix - array of 16 numbers - matrix
|
||||
|
||||
> [!WARNING]
|
||||
@@ -98,7 +99,23 @@ mat4.rotate(m: matrix, axis: vec3, angle: number)
|
||||
mat4.rotate(m: matrix, axis: vec3, angle: number, dst: matrix)
|
||||
```
|
||||
|
||||
## Translation to string - *mat4.tostring(...)*
|
||||
## Decomposition - *mat4.decompose(...)*
|
||||
|
||||
Decomposes the transformation matrix into its components.
|
||||
|
||||
```lua
|
||||
mat4.decompose(m: matrix)
|
||||
-- returns a table:
|
||||
{
|
||||
scale=vec3,
|
||||
rotation=matrix,
|
||||
translation=vec3,
|
||||
skew=vec3,
|
||||
perspective=vec4
|
||||
}
|
||||
```
|
||||
|
||||
## Casting to string - *mat4.tostring(...)*
|
||||
|
||||
```lua
|
||||
-- returns a string representing the contents of the matrix
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
На данной странице будут использоваться условные обозначения типов.
|
||||
- vector - массив из трех или четырех чисел
|
||||
- vec3 - массив из трех чисел
|
||||
- vec4 - массив из четырех чисел
|
||||
- matrix - массив из 16 чисел - матрица
|
||||
|
||||
> [!WARNING]
|
||||
@@ -98,6 +99,22 @@ mat4.rotate(m: matrix, axis: vec3, angle: number)
|
||||
mat4.rotate(m: matrix, axis: vec3, angle: number, dst: matrix)
|
||||
```
|
||||
|
||||
## Декомпозиция - *mat4.decompose(...)*
|
||||
|
||||
Раскладывает матрицу трансформации на составляющие.
|
||||
|
||||
```lua
|
||||
mat4.decompose(m: matrix)
|
||||
-- возвращает таблицу:
|
||||
{
|
||||
scale=vec3,
|
||||
rotation=matrix,
|
||||
translation=vec3,
|
||||
skew=vec3,
|
||||
perspective=vec4
|
||||
}
|
||||
```
|
||||
|
||||
## Перевод в строку - *mat4.tostring(...)*
|
||||
|
||||
```lua
|
||||
|
||||
Reference in New Issue
Block a user