Реорганизация методов для версоров и тангентов
This commit is contained in:
parent
0027924f86
commit
e39765b733
5 changed files with 147 additions and 247 deletions
|
|
@ -12,7 +12,7 @@
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BgcVersorFP32 versor1, versor2, result;
|
BgcVersorFP32 versor1, versor2, result;
|
||||||
//BgcMatrix3x3FP32 matrix;
|
//BgcMatrix3x3FP32 matrix;
|
||||||
BgcVector3FP32 vector1, vector2;
|
//BgcVector3FP32 vector1, vector2;
|
||||||
} structure_fp32_t;
|
} structure_fp32_t;
|
||||||
|
|
||||||
structure_fp32_t* allocate_structures(const unsigned int amount)
|
structure_fp32_t* allocate_structures(const unsigned int amount)
|
||||||
|
|
@ -50,7 +50,7 @@ structure_fp32_t* make_structures(const unsigned int amount)
|
||||||
bgc_versor_reset_fp32(&list[i].result);
|
bgc_versor_reset_fp32(&list[i].result);
|
||||||
|
|
||||||
//bgc_matrix3x3_set_to_identity_fp32(&list[i].matrix);
|
//bgc_matrix3x3_set_to_identity_fp32(&list[i].matrix);
|
||||||
|
/*
|
||||||
bgc_vector3_set_values_fp32(
|
bgc_vector3_set_values_fp32(
|
||||||
rand() * multiplier - 1.0f,
|
rand() * multiplier - 1.0f,
|
||||||
rand() * multiplier - 1.0f,
|
rand() * multiplier - 1.0f,
|
||||||
|
|
@ -59,6 +59,7 @@ structure_fp32_t* make_structures(const unsigned int amount)
|
||||||
);
|
);
|
||||||
|
|
||||||
bgc_vector3_reset_fp32(&list[i].vector2);
|
bgc_vector3_reset_fp32(&list[i].vector2);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
|
|
@ -84,51 +85,37 @@ void print_vector_fp64(const BgcVector3FP64* vector)
|
||||||
printf("(%lf, %lf, %lf) / %lf\n", vector->x1, vector->x2, vector->x3, bgc_vector3_get_modulus_fp64(vector));
|
printf("(%lf, %lf, %lf) / %lf\n", vector->x1, vector->x2, vector->x3, bgc_vector3_get_modulus_fp64(vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
void item_work(structure_fp32_t* item)
|
void list_work(const uint_fast32_t amount, structure_fp32_t* list)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < 1000; j++) {
|
for (uint_fast32_t j = 0; j < 1000; j++) {
|
||||||
bgc_versor_combine_fp32(&item->versor1, &item->versor2, &item->result);
|
for (uint_fast32_t i = 0; i < amount; i++) {
|
||||||
//bgc_versor_turn_vector_fp32(&item->result, &item->vector1, &item->vector2);
|
bgc_versor_combine_fp32(&list[i].versor1, &list[i].versor1, &list[i].result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
const unsigned int amount = 1000000;
|
const unsigned int amount = 1000000;
|
||||||
structure_fp32_t* list;
|
structure_fp32_t* list = make_structures(amount);
|
||||||
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
ULONGLONG now, start, end;
|
ULONGLONG start, end;
|
||||||
now = GetTickCount64();
|
|
||||||
srand((unsigned int)(now & 0xfffffff));
|
start = GetTickCount64();
|
||||||
|
|
||||||
|
srand((unsigned int)(start & 0xfffffff));
|
||||||
|
|
||||||
|
start = GetTickCount64();
|
||||||
#else
|
#else
|
||||||
struct timespec start, end;
|
struct timespec start, end;
|
||||||
clock_gettime(0, &start);
|
clock_gettime(0, &start);
|
||||||
srand((unsigned int)(start.tv_nsec & 0xfffffff));
|
srand((unsigned int)(start.tv_nsec & 0xfffffff));
|
||||||
#endif // _WIN64
|
|
||||||
|
|
||||||