mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
add mat4.decompose
This commit is contained in:
parent
5977c9c241
commit
66dd54b548
3 changed files with 82 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue