mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 13:01:49 +00:00
remove duplicated
This commit is contained in:
parent
22b70b701e
commit
305dab7ead
2 changed files with 11 additions and 45 deletions
|
|
@ -9,10 +9,7 @@ Quaternions can be created as a table of 4 numbers:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- creates a quaternion based on the rotation matrix
|
-- creates a quaternion based on the rotation matrix
|
||||||
quat.from_mat4(m: matrix)
|
quat.from_mat4(m: matrix, [optional] dst: quat) -> quat
|
||||||
|
|
||||||
-- writes a quaternion from the rotation matrix to dst
|
|
||||||
quat.from_mat4(m: matrix, dst: quat)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Quaternion of Euler angles - *quat.from_euler(...)*
|
## Quaternion of Euler angles - *quat.from_euler(...)*
|
||||||
|
|
@ -20,31 +17,21 @@ quat.from_mat4(m: matrix, dst: quat)
|
||||||
```lua
|
```lua
|
||||||
-- creates quaternion from euler angles passed as XYZ (pitch, yaw, roll)
|
-- creates quaternion from euler angles passed as XYZ (pitch, yaw, roll)
|
||||||
-- angles in degrees
|
-- angles in degrees
|
||||||
quat.from_euler(euler: vec3) -> quat
|
quat.from_euler(euler: vec3, [optional] dst: quat) -> quat
|
||||||
|
|
||||||
-- writes quaternion from euler angles passed as XYZ (pitch, yaw, roll) to dst
|
|
||||||
-- angles in degrees
|
|
||||||
quat.from_euler(euler: vec3, dst: quat)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Quaternion composition - quat.mul(...)
|
## Quaternion composition - quat.mul(...)
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- multiplies quaternions
|
-- multiplies quaternions
|
||||||
quat.mul(a: quat, b: quat) -> quat
|
quat.mul(a: quat, b: quat, [optional] dst: quat) -> quat
|
||||||
|
|
||||||
-- writes a quaternions multiplication result to dst
|
|
||||||
quat.mul(a: quat, b: quat, dst: quat)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 3D vector rotation - quat.mul_vec3(...)
|
## 3D vector rotation - quat.mul_vec3(...)
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- rotates vector by quaternion
|
-- rotates vector by quaternion
|
||||||
quat.mul_vec3(a: quat, b: vec3) -> vec3
|
quat.mul_vec3(a: quat, b: vec3, [optional] dst: vec3) -> vec3
|
||||||
|
|
||||||
-- writes rotated vector by quaternion to dst
|
|
||||||
quat.mul_vec3(a: quat, b: vec3, dst: vec3)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Spherical linear interpolation - *quat.slerp(...)*
|
## Spherical linear interpolation - *quat.slerp(...)*
|
||||||
|
|
@ -54,16 +41,12 @@ The interpolation always take the short path and the rotation is performed at co
|
||||||
```lua
|
```lua
|
||||||
-- creates a quaternion as an interpolation between a and b,
|
-- creates a quaternion as an interpolation between a and b,
|
||||||
-- where t is interpolation factor
|
-- where t is interpolation factor
|
||||||
quat.slerp(a: quat, b: quat, t: number)
|
quat.slerp(a: quat, b: quat, t: number, [optional] dst: quat) -> quat
|
||||||
|
|
||||||
-- writes a quaternion as an interpolation between a and b to dst,
|
|
||||||
-- where t is interpolation factor
|
|
||||||
quat.slerp(a: quat, b: quat, t: number, dst: quat)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Casting to string - *quat.tostring(...)*
|
## Casting to string - *quat.tostring(...)*
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- returns a string representing the contents of the quaternion
|
-- returns a string representing the contents of the quaternion
|
||||||
quat.tostring(q: quat)
|
quat.tostring(q: quat) -> string
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,7 @@
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- создаёт кватернион на основе матрицы вращения
|
-- создаёт кватернион на основе матрицы вращения
|
||||||
quat.from_mat4(m: matrix) -> quat
|
quat.from_mat4(m: matrix, [опционально] dst: quat) -> quat
|
||||||
|
|
||||||
-- записывает кватернион по матрице вращения в dst
|
|
||||||
quat.from_mat4(m: matrix, dst: quat)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Кватернион из углов Эйлера - *quat.from_euler(...)*
|
## Кватернион из углов Эйлера - *quat.from_euler(...)*
|
||||||
|
|
@ -20,31 +17,21 @@ quat.from_mat4(m: matrix, dst: quat)
|
||||||
```lua
|
```lua
|
||||||
-- создаёт кватернион на основе вектора, содержащего углы Эйлера в порядке XYZ (pitch, yaw, roll)
|
-- создаёт кватернион на основе вектора, содержащего углы Эйлера в порядке XYZ (pitch, yaw, roll)
|
||||||
-- (значения углов строго в градусах)
|
-- (значения углов строго в градусах)
|
||||||
quat.from_euler(euler: vec3) -> quat
|
quat.from_euler(euler: vec3, [опционально] dst: quat) -> quat
|
||||||
|
|
||||||
-- записывает кватернион в dst на основе вектора, содержащего углы Эйлера в порядке XYZ (pitch, yaw, roll)
|
|
||||||
-- (значения углов строго в градусах)
|
|
||||||
quat.from_euler(euler: vec3, dst: quat)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Композиция кватернионов - quat.mul(...)
|
## Композиция кватернионов - quat.mul(...)
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- Умножает два кватерниона (композиция поворотов)
|
-- Умножает два кватерниона (композиция поворотов)
|
||||||
quat.mul(a: quat, b: quat) -> quat
|
quat.mul(a: quat, b: quat, [опционально] dst: quat) -> quat
|
||||||
|
|
||||||
-- Записывает кватернион как произведение двух кватернионов (композиция поворотов)
|
|
||||||
quat.mul(a: quat, b: quat, dst: quat)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Поворот 3д вектора на кватернион - quat.mul_vec3(...)
|
## Поворот 3д вектора на кватернион - quat.mul_vec3(...)
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
-- Поворачивает вектор на заданный кватернион
|
-- Поворачивает вектор на заданный кватернион
|
||||||
quat.mul_vec3(a: quat, b: vec3) -> vec3
|
quat.mul_vec3(a: quat, b: vec3, [опционально] dst: vec3) -> vec3
|
||||||
|
|
||||||
-- Записывает результат поворота вектора на заданный кватернион
|
|
||||||
quat.mul_vec3(a: quat, b: vec3, dst: vec3)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Сферическая линейная интерполяция - *quat.slerp(...)*
|
## Сферическая линейная интерполяция - *quat.slerp(...)*
|
||||||
|
|
@ -54,11 +41,7 @@ quat.mul_vec3(a: quat, b: vec3, dst: vec3)
|
||||||
```lua
|
```lua
|
||||||
-- создаёт кватернион как интерполяцию между a и b,
|
-- создаёт кватернион как интерполяцию между a и b,
|
||||||
-- где t - фактор интерполяции
|
-- где t - фактор интерполяции
|
||||||
quat.slerp(a: quat, b: quat, t: number) -> quat
|
quat.slerp(a: quat, b: quat, t: number, [опционально] dst: quat) -> quat
|
||||||
|
|
||||||
-- записывает кватернион как интерполяцию между a и b в dst,
|
|
||||||
-- где t - фактор интерполяции
|
|
||||||
quat.slerp(a: quat, b: quat, t: number, dst: quat)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Перевод в строку - *quat.tostring(...)*
|
## Перевод в строку - *quat.tostring(...)*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue