Большое переименование

This commit is contained in:
Andrey Pokidov 2024-11-20 16:53:12 +07:00
parent e354b2425c
commit e7616ae80c
30 changed files with 1356 additions and 1348 deletions

View file

@ -9,36 +9,36 @@
#include <time.h>
#endif // _WINDOWS_
SPVersor * allocate_versors(const unsigned int amount)
BgFP32Versor * allocate_versors(const unsigned int amount)
{
return calloc(amount, sizeof(SPVersor));
return calloc(amount, sizeof(BgFP32Versor));
}
SPVersor * make_zero_versors(const unsigned int amount)
BgFP32Versor * make_zero_versors(const unsigned int amount)
{
SPVersor * list = allocate_versors(amount);
BgFP32Versor * list = allocate_versors(amount);
if (list == 0) {
return 0;
}
for (unsigned int i = 0; i < amount; i++) {
sp_versor_reset(&list[i]);
bg_fp32_versor_reset(&list[i]);
}
return list;
}
SPVersor * make_random_versors(const unsigned int amount)
BgFP32Versor * make_random_versors(const unsigned int amount)
{
SPVersor * list = allocate_versors(amount);
BgFP32Versor * list = allocate_versors(amount);
if (list == 0) {
return 0;
}
for (unsigned int i = 0; i < amount; i++) {
sp_versor_set(
bg_fp32_versor_set_values(
(2.0f * rand()) / RAND_MAX - 1.0f,
(2.0f * rand()) / RAND_MAX - 1.0f,
(2.0f * rand()) / RAND_MAX - 1.0f,
@ -50,14 +50,14 @@ SPVersor * make_random_versors(const unsigned int amount)
return list;
}
void print_versor(const SPVersor* versor)
void print_versor(const BgFP32Versor* versor)
{
printf("(%f, %f, %f, %f)\n", versor->_s0, versor->_x1, versor->_x2, versor->_x3);
}
void print_vector(const SPVector3* vector)
void print_vector(const BgFP32Vector3* vector)
{
printf("(%f, %f, %f) / %f\n", vector->x1, vector->x2, vector->x3, sp_vector3_get_module(vector));
printf("(%f, %f, %f) / %f\n", vector->x1, vector->x2, vector->x3, bg_fp32_vector3_get_module(vector));
}
/*
int main()
@ -74,17 +74,17 @@ int main()
srand((unsigned int)(now.tv_nsec & 0xfffffff));
#endif // _WIN64
SPVersor * versors = make_random_versors(amount);
BgFP32Versor * versors = make_random_versors(amount);
if (versors == 0) {
printf("Cannot allocate memory for versors");
return 0;
}
SPVector3 initial, result;
BgFP32Vector3 initial, result;
sp_vector3_set_values(1, 2, 3, &initial);
sp_vector3_copy(&initial, &result);
bg_fp32_vector3_set_values(1, 2, 3, &initial);
bg_fp32_vector3_copy(&initial, &result);
#ifdef _WIN64
ULONGLONG start, end;
@ -94,11 +94,11 @@ int main()
clock_gettime(CLOCK_REALTIME, &start);
#endif // _WIN64
for (unsigned int i = 0; i < amount; i++) {
sp_versor_turn2(&versors[i], &result, &result);
bg_fp32_versor_turn2(&versors[i], &result, &result);
}
for (unsigned int i = amount; i > 0; i--) {
sp_versor_turn_back2(&versors[i - 1], &result, &result);
bg_fp32_versor_turn_back2(&versors[i - 1], &result, &result);
}
#ifdef _WIN64
@ -135,14 +135,14 @@ int main()
srand((unsigned int)(now.tv_nsec & 0xfffffff));
#endif // _WIN64
SPVersor * versors1 = make_random_versors(amount);
BgFP32Versor * versors1 = make_random_versors(amount);
if (versors1 == 0) {
printf("Cannot allocate memory for versors1");
return 0;
}
SPVersor * versors2 = make_random_versors(amount);
BgFP32Versor * versors2 = make_random_versors(amount);
if (versors2 == 0) {
printf("Cannot allocate memory for versors2");
@ -150,7 +150,7 @@ int main()
return 0;
}
SPVersor * results = make_zero_versors(amount);
BgFP32Versor * results = make_zero_versors(amount);
if (results == 0) {
printf("Cannot allocate memory for results");
@ -168,7 +168,7 @@ int main()
#endif // _WIN64
for (int j = 0; j < 1000; j++) {
for (unsigned int i = 0; i < amount; i++) {
sp_versor_combine(&versors1[i], &versors2[i], &results[i]);
bg_fp32_versor_combine(&versors1[i], &versors2[i], &results[i]);
}
}