Переименование типов в соответствии со стилем POSIX, отказ от префикса bg_
This commit is contained in:
parent
d2a25823a5
commit
605afabd94
25 changed files with 1109 additions and 1035 deletions
|
|
@ -9,29 +9,172 @@
|
|||
#include <time.h>
|
||||
#endif // _WINDOWS_
|
||||
|
||||
BgFP32Vector3* allocate_vectors3(const unsigned int amount)
|
||||
typedef struct {
|
||||
// fp32_versor_t versor1, versor2, result;
|
||||
fp32_matrix3x3_t matrix;
|
||||
fp32_vector3_t vector1, vector2;
|
||||
} fp32_structure_t;
|
||||
|
||||
fp32_structure_t* allocate_structures(const unsigned int amount)
|
||||
{
|
||||
return calloc(amount, sizeof(BgFP32Vector3));
|
||||
return calloc(amount, sizeof(fp32_structure_t));
|
||||
}
|
||||
|
||||
BgFP32Vector3* make_zero_vectors3(const unsigned int amount)
|
||||
fp32_structure_t* make_structures(const unsigned int amount)
|
||||
{
|
||||
BgFP32Vector3* list = allocate_vectors3(amount);
|
||||
fp32_structure_t* list = allocate_structures(amount);
|
||||
|
||||
if (list == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const float multiplier = 2.0f / RAND_MAX;
|
||||
|
||||
for (unsigned int i = 0; i < amount; i++) {
|
||||
/*
|
||||
fp32_versor_set_values(
|
||||
rand() * multiplier - 1.0f,
|
||||
rand() * multiplier - 1.0f,
|
||||
rand() * multiplier - 1.0f,
|
||||
rand() * multiplier - 1.0f,
|
||||
&list[i].versor1
|
||||
);
|
||||
|
||||
fp32_versor_set_values(
|
||||
rand() * multiplier - 1.0f,
|
||||
rand() * multiplier - 1.0f,
|
||||
rand() * multiplier - 1.0f,
|
||||
rand() * multiplier - 1.0f,
|
||||
&list[i].versor2
|
||||
);
|
||||
|
||||
fp32_versor_reset(&list[i].result);
|
||||
*/
|
||||
fp32_matrix3x3_set_to_identity(&list[i].matrix);
|
||||
|
||||
fp32_vector3_set_values(
|
||||
rand() * multiplier - 1.0f,
|
||||
rand() * multiplier - 1.0f,
|
||||
rand() * multiplier - 1.0f,
|
||||
&list[i].vector1
|
||||
);
|
||||
|
||||
fp32_vector3_reset(&list[i].vector2);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void print_versor(const fp32_versor_t* versor)
|
||||
{
|
||||
printf("Versor (%f, %f, %f, %f)\n", versor->s0, versor->x1, versor->x2, versor->x3);
|
||||
}
|
||||
|
||||
void print_vector(const fp32_vector3_t* vector)
|
||||
{
|
||||
printf("(%f, %f, %f) / %f\n", vector->x1, vector->x2, vector->x3, fp32_vector3_get_modulus(vector));
|
||||
}
|
||||
|
||||
void item_work(fp32_structure_t* item)
|
||||
{
|
||||
//fp32_versor_combine(&item->versor1, &item->versor1, &item->result);
|
||||
//fp32_versor_make_rotation_matrix(&item->result, &item->matrix);
|
||||
fp32_matrix3x3_right_product(&item->matrix, &item->vector1, &item->vector2);
|
||||
}
|
||||
|
||||
void circle_work(const unsigned int amount, fp32_structure_t* list)
|
||||
{
|
||||