From bef7ab98f428196ddae9f39bfa763541581fa3e5 Mon Sep 17 00:00:00 2001 From: Andrey Pokidov Date: Mon, 25 Nov 2024 16:35:36 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B0=D1=86=D0=B8=D1=8F:=20=D0=BA=D0=B2=D0=B0=D1=82?= =?UTF-8?q?=D0=B5=D1=80=D0=BD=D0=B8=D0=BE=D0=BD=D1=8B=20=D0=B8=20=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D1=81=D0=BE=D1=80=D1=8B=20/=20Documentation:=20qua?= =?UTF-8?q?ternions=20and=20versors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- basic-geometry-dev/main.c | 14 ++++++++++--- docs/.~lock.documentation.odt# | 1 + docs/quaternion-eng.md | 5 +++-- docs/quaternion-rus.md | 5 +++-- docs/versor_reset-eng.md | 36 +++++++++++++++++++++++++++++++++ docs/versor_reset-rus.md | 37 ++++++++++++++++++++++++++++++++++ 6 files changed, 91 insertions(+), 7 deletions(-) create mode 100644 docs/.~lock.documentation.odt# create mode 100644 docs/versor_reset-eng.md create mode 100644 docs/versor_reset-rus.md diff --git a/basic-geometry-dev/main.c b/basic-geometry-dev/main.c index 20ad59c..1982d8a 100644 --- a/basic-geometry-dev/main.c +++ b/basic-geometry-dev/main.c @@ -3,8 +3,6 @@ #include #include -#define _POSIX_C_SOURCE >= 199309L - #ifdef _WIN64 #include #else @@ -122,7 +120,7 @@ int main() } */ - +/* int main() { const unsigned int amount = 1000000; @@ -193,4 +191,14 @@ int main() free(versors1); 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; +} diff --git a/docs/.~lock.documentation.odt# b/docs/.~lock.documentation.odt# new file mode 100644 index 0000000..a45c758 --- /dev/null +++ b/docs/.~lock.documentation.odt# @@ -0,0 +1 @@ +,andrey,andrey-pokidov-pc,25.11.2024 16:20,file:///home/andrey/.config/libreoffice/4; \ No newline at end of file diff --git a/docs/quaternion-eng.md b/docs/quaternion-eng.md index 93bf626..306117a 100644 --- a/docs/quaternion-eng.md +++ b/docs/quaternion-eng.md @@ -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 to 1. -At the same time a developer can read the fields of a versor for his|her own -needs, for example, for saving a versor in a file or pass it via a network. +At the same time a developer can read the fields of a versor for their own +needs, for example, for some computations or for saving a versor in a file +or for passing it via a computer network. diff --git a/docs/quaternion-rus.md b/docs/quaternion-rus.md index c331b44..726bf98 100644 --- a/docs/quaternion-rus.md +++ b/docs/quaternion-rus.md @@ -93,6 +93,7 @@ функции версоров обеспечивают, чтобы модуль версора был равен единице. В то же время, разработчик может обращаться к полям версора, чтобы получить -значения этих полей для своих целей, например, чтобы сохранить значение -версора в файле или передать по сети. +значения этих полей для своих целей, например, чтобы сделать какие-либо +вычисления или сохранить состояние версора в файле, или передать версор через +подключение по компьютерной сети. diff --git a/docs/versor_reset-eng.md b/docs/versor_reset-eng.md new file mode 100644 index 0000000..516eb73 --- /dev/null +++ b/docs/versor_reset-eng.md @@ -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 + #include + + 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) + diff --git a/docs/versor_reset-rus.md b/docs/versor_reset-rus.md new file mode 100644 index 0000000..7fb1049 --- /dev/null +++ b/docs/versor_reset-rus.md @@ -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 + #include + + 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) +