Улучшение структуры документации
This commit is contained in:
parent
72b6690ad6
commit
f8f6b07c81
20 changed files with 262 additions and 156 deletions
53
docs/versor/versor-reset-eng.md
Normal file
53
docs/versor/versor-reset-eng.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
# State reset functions for versors
|
||||
|
||||
[A versor](./versor-eng.md) that corresponds to no rotation has the following component values:
|
||||
|
||||
```
|
||||
s0 = 1;
|
||||
x1 = 0;
|
||||
x2 = 0;
|
||||
x3 = 0;
|
||||
```
|
||||
|
||||
To set such a state for the versor components, the library has the corresponding functions.
|
||||
|
||||
For the **BgFP32Versor** type, the function is:
|
||||
|
||||
```c
|
||||
inline void bgc_versor_reset_fp32(BgFP32Versor* versor);
|
||||
```
|
||||
|
||||
For the **BgFP64Versor** type, the function is:
|
||||
|
||||
```c
|
||||
inline void bgc_versor_reset_fp64(BgFP64Versor* versor);
|
||||
```
|
||||
|
||||
The **versor** parameter must be a valid pointer and must not be NULL.
|
||||
|
||||
These functions are well suited for initializing the state of variables of the **BgFP32Versor** and **BgFP64Versor** types.
|
||||
|
||||
Usage example:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main() {
|
||||
BgFP32Versor versor;
|
||||
|
||||
bgc_versor_reset_fp32(&versor);
|
||||
|
||||
printf("Versor: (%f, %f, %f, %f)\n", versor.s0, versor.x1, versor.x2, versor.x3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```
|
||||
Versor: (1.000000, 0.000000, 0.000000, 0.000000)
|
||||
```
|
||||
|
||||
[Versors](./versor-eng.md)
|
53
docs/versor/versor-reset-rus.md
Normal file
53
docs/versor/versor-reset-rus.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
# Функции сброса состояния для версоров
|
||||
|
||||
[Версор](./versor-rus.md), который соответствует отсутствию поворота, имеет следующие значеия компонент:
|
||||
|
||||
```
|
||||
s0 = 1;
|
||||
x1 = 0;
|
||||
x2 = 0;
|
||||
x3 = 0;
|
||||
```
|
||||
|
||||
Чтобы установить такое состояние для компонент версора, в библиотеке есть соответствующие функции.
|
||||
|
||||
Для типа **BgFP32Versor** функция имеет вид:
|
||||
|
||||
```c
|
||||
inline void bgc_versor_reset_fp32(BgFP32Versor* versor);
|
||||
```
|
||||
|
||||
Для типа **BgFP64Versor** функция имеет вид:
|
||||
|
||||
```c
|
||||
inline void bgc_versor_reset_fp64(BgFP64Versor* versor);
|
||||
```
|
||||
|
||||
Параметр **versor** должен быть корректным указателем, а также не должен быть равен NULL.
|
||||
|
||||
Эти функции хорошо подходят для инициализации состояния переменных типов **BgFP32Versor** и **BgFP64Versor**.
|
||||
|
||||
Пример использования:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main() {
|
||||
BgFP32Versor versor;
|
||||
|
||||
bgc_versor_reset_fp32(&versor);
|
||||
|
||||
printf("Versor: (%f, %f, %f, %f)\n", versor.s0, versor.x1, versor.x2, versor.x3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
Результат:
|
||||
|
||||
```
|
||||
Versor: (1.000000, 0.000000, 0.000000, 0.000000)
|
||||
```
|
||||
|
||||
[Библиотека базовых геометрических вычислений](./intro-rus.md) / [Версоры](./versor-rus.md)
|
56
docs/versor/versor-set-values-eng.md
Normal file
56
docs/versor/versor-set-values-eng.md
Normal file
|
@ -0,0 +1,56 @@
|
|||
# Functions that set the values of the versor components
|
||||
|
||||
Special functions are provided to specify specific values ??for the versor components.
|
||||
|
||||
For the **BgFP32Versor** type, the function has the form:
|
||||
|
||||
```c
|
||||
inline void bgc_versor_set_values_fp32(const float s0, const float x1, const float x2, const float x3, BgcVersorFP32* versor);
|
||||
```
|
||||
|
||||
For the **BgFP64Versor** type, the function has the form:
|
||||
|
||||
```c
|
||||
inline void bgc_versor_set_values_fp64(const double s0, const double x1, const double x2, const double x3, BgcVersorFP64* versor);
|
||||
```
|
||||
|
||||
These functions set the values ??passed in the **s0**, **x1**, **x2**, and **x3** parameters to the corresponding components of the versor passed by pointer in the **versor** parameter. But if the resulting state is not a normalized quaternion, then the functions normalize the versor.
|
||||
|
||||
The **versor** parameter must be a valid pointer and must not be NULL.
|
||||
|
||||
These functions are also well suited for initializing the state of variables of types **BgFP32Versor** and **BgFP64Versor**, as are the functions [bgc_versor_reset_fp32 and bgc_versor_reset_fp64](./versor-reset-eng.md).
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main() {
|
||||
BgcVersorFP64 versor;
|
||||
|
||||
bgc_versor_set_values_fp64(1, 2, 3, 4, &versor);
|
||||
|
||||
printf("Versor: (%lf, %lf, %lf, %lf)\n", versor.s0, versor.x1, versor.x2, versor.x3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```
|
||||
Versor: (0.182574, 0.365148, 0.547723, 0.730297)
|
||||
```
|
||||
|
||||
If zeros are passed to the function as component values, then the versor, the pointer to which is passed in the **versor** parameter, will be set to the state corresponding to the absence of rotation:
|
||||
|
||||
```c
|
||||
bgc_versor_set_values_fp64(0, 0, 0, 0, &versor);
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```
|
||||
Versor: (1.000000, 0.000000, 0.000000, 0.000000)
|
||||
```
|
||||
|
||||
[Versors](./versor-eng.md)
|
58
docs/versor/versor-set-values-rus.md
Normal file
58
docs/versor/versor-set-values-rus.md
Normal file
|
@ -0,0 +1,58 @@
|
|||
# Функции устанавливащие значения компоенен версора
|
||||
|
||||
Чтобы указать конкретные значения для компонент версора предусмотрены специальные функции.
|
||||
|
||||
Для типа **BgFP32Versor** функция имеет вид:
|
||||
|
||||
```c
|
||||
inline void bgc_versor_set_values_fp32(const float s0, const float x1, const float x2, const float x3, BgcVersorFP32* versor);
|
||||
```
|
||||
|
||||
Для типа **BgFP64Versor** функция имеет вид:
|
||||
|
||||
```c
|
||||
inline void bgc_versor_set_values_fp64(const double s0, const double x1, const double x2, const double x3, BgcVersorFP64* versor);
|
||||
```
|
||||
|
||||
Данные функции устанавливают значения, переданные в параметрах **s0**, **x1**, **x2** и **x3**, в соответствующе компоненты версора, переданного по указателю в параметре **versor**. Но если получившееся состояние не является нормализованным кватернионом, то функции нормализуют версор.
|
||||
|
||||
Параметр **versor** должен быть корректным указателем, а также не должен быть равен NULL.
|
||||
|
||||
Данные функции также хорошо подходят для инициализации состояния переменных типов **BgFP32Versor** и **BgFP64Versor** как и функции [bgc_versor_reset_fp32 и bgc_versor_reset_fp64](./versor-reset-eng.md).
|
||||
|
||||
Пример использования:
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <basic-geometry.h>
|
||||
|
||||
int main() {
|
||||
BgcVersorFP64 versor;
|
||||
|
||||
bgc_versor_set_values_fp64(1, 2, 3, 4, &versor);
|
||||
|
||||
printf("Versor: (%lf, %lf, %lf, %lf)\n", versor.s0, versor.x1, versor.x2, versor.x3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
Результат:
|
||||
|
||||
```
|
||||
Versor: (0.182574, 0.365148, 0.547723, 0.730297)
|
||||
```
|
||||
|
||||
Если в качестве значений компонент в функцию передать нули, то версор, указатель на который передан в параметре **versor**, будет установлен в состояние, соответствующее отсутствию поворота:
|
||||
|
||||
```c
|
||||
bgc_versor_set_values_fp64(0, 0, 0, 0, &versor);
|
||||
```
|
||||
|
||||
Результат:
|
||||
|
||||
```
|
||||
Versor: (1.000000, 0.000000, 0.000000, 0.000000)
|
||||
```
|
||||
|
||||
[Библиотека базовых геометрических вычислений](./intro-rus.md) / [Версоры](./versor-rus.md)
|
Loading…
Add table
Add a link
Reference in a new issue