Завершение большого переименования
This commit is contained in:
parent
120e651517
commit
3805354611
31 changed files with 1213 additions and 1255 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _BASIC_GEOMETRY_VECTOR2_H_
|
||||
#define _BASIC_GEOMETRY_VECTOR2_H_
|
||||
#ifndef _BGC_VECTOR2_H_
|
||||
#define _BGC_VECTOR2_H_
|
||||
|
||||
#include "basis.h"
|
||||
#include "utilities.h"
|
||||
#include "angle.h"
|
||||
|
||||
#include <math.h>
|
||||
|
|
@ -9,22 +9,22 @@
|
|||
typedef struct
|
||||
{
|
||||
float x1, x2;
|
||||
} vector2_fp32_t;
|
||||
} bgc_vector2_fp32_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x1, x2;
|
||||
} vector2_fp64_t;
|
||||
} bgc_vector2_fp64_t;
|
||||
|
||||
// =================== Reset ==================== //
|
||||
|
||||
inline void vector2_reset_fp32(vector2_fp32_t* vector)
|
||||
inline void bgc_vector2_reset_fp32(bgc_vector2_fp32_t* vector)
|
||||
{
|
||||
vector->x1 = 0.0f;
|
||||
vector->x2 = 0.0f;
|
||||
}
|
||||
|
||||
inline void vector2_reset_fp64(vector2_fp64_t* vector)
|
||||
inline void bgc_vector2_reset_fp64(bgc_vector2_fp64_t* vector)
|
||||
{
|
||||
vector->x1 = 0.0;
|
||||
vector->x2 = 0.0;
|
||||
|
|
@ -32,13 +32,13 @@ inline void vector2_reset_fp64(vector2_fp64_t* vector)
|
|||
|
||||
// ==================== Set ===================== //
|
||||
|
||||
inline void vector2_set_values_fp32(const float x1, const float x2, vector2_fp32_t* to)
|
||||
inline void bgc_vector2_set_values_fp32(const float x1, const float x2, bgc_vector2_fp32_t* to)
|
||||
{
|
||||
to->x1 = x1;
|
||||
to->x2 = x2;
|
||||
}
|
||||
|
||||
inline void vector2_set_values_fp64(const double x1, const double x2, vector2_fp64_t* to)
|
||||
inline void bgc_vector2_set_values_fp64(const double x1, const double x2, bgc_vector2_fp64_t* to)
|
||||
{
|
||||
to->x1 = x1;
|
||||
to->x2 = x2;
|
||||
|
|
@ -46,13 +46,13 @@ inline void vector2_set_values_fp64(const double x1, const double x2, vector2_fp
|
|||
|
||||
// ==================== Copy ==================== //
|
||||
|
||||
inline void vector2_copy_fp32(const vector2_fp32_t* from, vector2_fp32_t* to)
|
||||
inline void bgc_vector2_copy_fp32(const bgc_vector2_fp32_t* from, bgc_vector2_fp32_t* to)
|
||||
{
|
||||
to->x1 = from->x1;
|
||||
to->x2 = from->x2;
|
||||
}
|
||||
|
||||
inline void vector2_copy_fp64(const vector2_fp64_t* from, vector2_fp64_t* to)
|
||||
inline void bgc_vector2_copy_fp64(const bgc_vector2_fp64_t* from, bgc_vector2_fp64_t* to)
|
||||
{
|
||||
to->x1 = from->x1;
|
||||
to->x2 = from->x2;
|
||||
|
|
@ -60,7 +60,7 @@ inline void vector2_copy_fp64(const vector2_fp64_t* from, vector2_fp64_t* to)
|
|||
|
||||
// ==================== Swap ==================== //
|
||||
|
||||
inline void vector2_swap_fp32(vector2_fp32_t* vector1, vector2_fp32_t* vector2)
|
||||
inline void bgc_vector2_swap_fp32(bgc_vector2_fp32_t* vector1, bgc_vector2_fp32_t* vector2)
|
||||
{
|
||||
const float x1 = vector2->x1;
|
||||
const float x2 = vector2->x2;
|
||||
|
|
@ -72,7 +72,7 @@ inline void vector2_swap_fp32(vector2_fp32_t* vector1, vector2_fp32_t* vector2)
|
|||
vector1->x2 = x2;
|
||||
}
|
||||
|
||||
inline void vector2_swap_fp64(vector2_fp64_t* vector1, vector2_fp64_t* vector2)
|
||||
inline void bgc_vector2_swap_fp64(bgc_vector2_fp64_t* vector1, bgc_vector2_fp64_t* vector2)
|
||||
{
|
||||
const double x1 = vector2->x1;
|
||||
const double x2 = vector2->x2;
|
||||
|
|
@ -86,13 +86,13 @@ inline void vector2_swap_fp64(vector2_fp64_t* vector1, vector2_fp64_t* vector2)
|
|||
|
||||
// ============= Copy to twin type ============== //
|
||||
|
||||
inline void vector2_convert_fp64_to_fp32(const vector2_fp64_t* from, vector2_fp32_t* to)
|
||||
inline void bgc_vector2_convert_fp64_to_fp32(const bgc_vector2_fp64_t* from, bgc_vector2_fp32_t* to)
|
||||
{
|
||||
to->x1 = (float)from->x1;
|
||||
to->x2 = (float)from->x2;
|
||||
}
|
||||
|
||||
inline void vector2_convert_fp32_to_fp64(const vector2_fp32_t* from, vector2_fp64_t* to)
|
||||
inline void bgc_vector2_convert_fp32_to_fp64(const bgc_vector2_fp32_t* from, bgc_vector2_fp64_t* to)
|
||||
{
|
||||
to->x1 = from->x1;
|
||||
to->x2 = from->x2;
|
||||
|
|
@ -100,13 +100,13 @@ inline void vector2_convert_fp32_to_fp64(const vector2_fp32_t* from, vector2_fp6
|
|||
|
||||
// =================== Reverse ================== //
|
||||
|
||||
inline void vector2_fp32_set_reverse(const vector2_fp32_t* from, vector2_fp32_t* to)
|
||||
inline void bgc_vector2_set_reverse_fp32(const bgc_vector2_fp32_t* from, bgc_vector2_fp32_t* to)
|
||||
{
|
||||
to->x1 = -from->x1;
|
||||
to->x2 = -from->x2;
|
||||
}
|
||||
|
||||
inline void vector2_fp64_set_reverse(const vector2_fp64_t* from, vector2_fp64_t* to)
|
||||
inline void bgc_vector2_set_reverse_fp64(const bgc_vector2_fp64_t* from, bgc_vector2_fp64_t* to)
|
||||
{
|
||||
to->x1 = -from->x1;
|
||||
to->x2 = -from->x2;
|
||||
|
|
@ -114,13 +114,13 @@ inline void vector2_fp64_set_reverse(const vector2_fp64_t* from, vector2_fp64_t*
|
|||
|
||||
// ============= Reverse twin type ============== //
|
||||
|
||||
inline void vector2_fp32_set_reverse_fp64(const vector2_fp64_t* from, vector2_fp32_t* to)
|
||||
inline void bgc_vector2_set_reverse_fp64_to_fp32(const bgc_vector2_fp64_t* from, bgc_vector2_fp32_t* to)
|
||||
{
|
||||
to->x1 = (float) -from->x1;
|
||||
to->x2 = (float) -from->x2;
|
||||
}
|
||||
|
||||
inline void vector2_fp64_set_reverse_fp32(const vector2_fp32_t* from, vector2_fp64_t* to)
|
||||
inline void bgc_vector2_set_reverse_fp32_to_fp64(const bgc_vector2_fp32_t* from, bgc_vector2_fp64_t* to)
|
||||
{
|
||||
to->x1 = -from->x1;
|
||||
to->x2 = -from->x2;
|
||||
|
|
@ -128,75 +128,89 @@ inline void vector2_fp64_set_reverse_fp32(const vector2_fp32_t* from, vector2_fp
|
|||
|
||||
// =================== Module =================== //
|
||||
|
||||
inline float vector2_get_square_modulus_fp32(const vector2_fp32_t* vector)
|
||||
inline float bgc_vector2_get_square_modulus_fp32(const bgc_vector2_fp32_t* vector)
|
||||
{
|
||||
return vector->x1 * vector->x1 + vector->x2 * vector->x2;
|
||||
}
|
||||
|
||||
inline double vector2_get_square_modulus_fp64(const vector2_fp64_t* vector)
|
||||
inline double bgc_vector2_get_square_modulus_fp64(const bgc_vector2_fp64_t* vector)
|
||||
{
|
||||
return vector->x1 * vector->x1 + vector->x2 * vector->x2;
|
||||
}
|
||||
|
||||
inline float vector2_get_modulus_fp32(const vector2_fp32_t* vector)
|
||||
inline float bgc_vector2_get_modulus_fp32(const bgc_vector2_fp32_t* vector)
|
||||
{
|
||||
return sqrtf(vector2_get_square_modulus_fp32(vector));
|
||||
return sqrtf(bgc_vector2_get_square_modulus_fp32(vector));
|
||||
}
|
||||
|
||||
inline double vector2_get_modulus_fp64(const vector2_fp64_t* vector)
|
||||
inline double bgc_vector2_get_modulus_fp64(const bgc_vector2_fp64_t* vector)
|
||||
{
|
||||
return sqrt(vector2_get_square_modulus_fp64(vector));
|
||||
return sqrt(bgc_vector2_get_square_modulus_fp64(vector));
|
||||
}
|
||||
|
||||
// ================= Comparison ================= //
|
||||
|
||||
inline int vector2_fp32_is_zero(const vector2_fp32_t* vector)
|
||||
inline int bgc_vector2_is_zero_fp32(const bgc_vector2_fp32_t* vector)
|
||||
{
|
||||
return vector2_get_square_modulus_fp32(vector) <= FP32_SQUARE_EPSYLON;
|
||||
return bgc_vector2_get_square_modulus_fp32(vector) <= BGC_SQUARE_EPSYLON_FP32;
|
||||
}
|
||||
|
||||
inline int vector2_fp64_is_zero(const vector2_fp64_t* vector)
|
||||
inline int bgc_vector2_is_zero_fp64(const bgc_vector2_fp64_t* vector)
|
||||
{
|
||||
return vector2_get_square_modulus_fp64(vector) <= FP64_SQUARE_EPSYLON;
|
||||
return bgc_vector2_get_square_modulus_fp64(vector) <= BGC_SQUARE_EPSYLON_FP64;
|
||||
}
|
||||
|
||||
inline int vector2_fp32_is_unit(const vector2_fp32_t* vector)
|
||||