Документация: кватернионы и версоры / Documentation: quaternions and versors
This commit is contained in:
parent
d3a9fecb67
commit
bef7ab98f4
6 changed files with 91 additions and 7 deletions
|
@ -3,8 +3,6 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <basic-geometry.h>
|
#include <basic-geometry.h>
|
||||||
|
|
||||||
#define _POSIX_C_SOURCE >= 199309L
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
|
@ -122,7 +120,7 @@ int main()
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
const unsigned int amount = 1000000;
|
const unsigned int amount = 1000000;
|
||||||
|
@ -193,4 +191,14 @@ int main()
|
||||||
free(versors1);
|
free(versors1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
BgFP32Versor versor;
|
||||||
|
|
||||||
|
bg_fp32_versor_reset(&versor);
|
||||||
|
|
||||||
|
printf("Versor: (%f, %f, %f, %f)\n", versor.s0, versor.x1, versor.x2, versor.x3);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
1
docs/.~lock.documentation.odt#
Normal file
1
docs/.~lock.documentation.odt#
Normal file
|
@ -0,0 +1 @@
|
||||||
|
,andrey,andrey-pokidov-pc,25.11.2024 16:20,file:///home/andrey/.config/libreoffice/4;
|
|
@ -93,6 +93,7 @@ versors to set the state of a versor instead of direct setting of
|
||||||
the field values because versor functions keep the modulus of a versor equal
|
the field values because versor functions keep the modulus of a versor equal
|
||||||
to 1.
|
to 1.
|
||||||
|
|
||||||
At the same time a developer can read the fields of a versor for his|her own
|
At the same time a developer can read the fields of a versor for their own
|
||||||
needs, for example, for saving a versor in a file or pass it via a network.
|
needs, for example, for some computations or for saving a versor in a file
|
||||||
|
or for passing it via a computer network.
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
функции версоров обеспечивают, чтобы модуль версора был равен единице.
|
функции версоров обеспечивают, чтобы модуль версора был равен единице.
|
||||||
|
|
||||||
В то же время, разработчик может обращаться к полям версора, чтобы получить
|
В то же время, разработчик может обращаться к полям версора, чтобы получить
|
||||||
значения этих полей для своих целей, например, чтобы сохранить значение
|
значения этих полей для своих целей, например, чтобы сделать какие-либо
|
||||||
версора в файле или передать по сети.
|
вычисления или сохранить состояние версора в файле, или передать версор через
|
||||||
|
подключение по компьютерной сети.
|
||||||
|
|
||||||
|
|
36
docs/versor_reset-eng.md
Normal file
36
docs/versor_reset-eng.md
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# Reset functions for versors
|
||||||
|
|
||||||
|
The functions reset the state of versors to the state of no turn:
|
||||||
|
|
||||||
|
s0 = 1, x1 = 0, x2 = 0, x3 = 0
|
||||||
|
|
||||||
|
For the **BgFP32Versor** type the function is:
|
||||||
|
|
||||||
|
void bg_fp32_versor_reset(BgFP32Versor* versor);
|
||||||
|
|
||||||
|
For the **BgFP64Versor** type the function is:
|
||||||
|
|
||||||
|
void bg_fp64_versor_reset(BgFP64Versor* versor);
|
||||||
|
|
||||||
|
These functions are good for setting the initial state of variables and fields
|
||||||
|
of **BgFP32Versor** and **BgFP64Versor** types.
|
||||||
|
|
||||||
|
Example of usage:
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <basic-geometry.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
BgFP32Versor versor;
|
||||||
|
|
||||||
|
bg_fp32_versor_reset(&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)
|
||||||
|
|
37
docs/versor_reset-rus.md
Normal file
37
docs/versor_reset-rus.md
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# Функции reset для версоров
|
||||||
|
|
||||||
|
Фунции сбрасывают состояние версора на состояние, соответствующее нулевому
|
||||||
|
повороту:
|
||||||
|
|
||||||
|
s0 = 1, x1 = 0, x2 = 0, x3 = 0
|
||||||
|
|
||||||
|
Для типа **BgFP32Versor** функция имеет вид:
|
||||||
|
|
||||||
|
void bg_fp32_versor_reset(BgFP32Versor* versor);
|
||||||
|
|
||||||
|
Для типа **BgFP64Versor** функция имеет вид:
|
||||||
|
|
||||||
|
void bg_fp64_versor_reset(BgFP64Versor* versor);
|
||||||
|
|
||||||
|
Данные функции хорошо подходят для инициализации состояния переменной типов
|
||||||
|
**BgFP32Versor** и **BgFP64Versor**.
|
||||||
|
|
||||||
|
Пример использования:
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <basic-geometry.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
BgFP32Versor versor;
|
||||||
|
|
||||||
|
bg_fp32_versor_reset(&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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue