Добавлены матрицы 2x3 и 3x2, добавлены произведения матриц. Изменения в названиях функций

This commit is contained in:
Andrey Pokidov 2024-11-13 12:41:05 +07:00
parent 86486ac9cf
commit 049f09f3d4
31 changed files with 1831 additions and 1314 deletions

View file

@ -38,6 +38,20 @@ static inline void dp_vector2_reset(DPVector2* vector)
vector->x2 = 0.0;
}
// ==================== Set ===================== //
static inline void sp_vector2_set_values(const float x1, const float x2, SPVector2* to)
{
to->x1 = x1;
to->x2 = x2;
}
static inline void dp_vector2_set_values(const double x1, const double x2, DPVector2* to)
{
to->x1 = x1;
to->x2 = x2;
}
// ==================== Copy ==================== //
static inline void sp_vector2_copy(const SPVector2* from, SPVector2* to)
@ -52,18 +66,46 @@ static inline void dp_vector2_copy(const DPVector2* from, DPVector2* to)
to->x2 = from->x2;
}
// ==================== Set ===================== //
// ============= Copy to twin type ============== //
static inline void sp_vector2_set(const float x1, const float x2, SPVector2* to)
static inline void sp_vector2_copy_from_double(const DPVector2* from, SPVector2* to)
{
to->x1 = x1;
to->x2 = x2;
to->x1 = (float)from->x1;
to->x2 = (float)from->x2;
}
static inline void dp_vector2_set(const double x1, const double x2, DPVector2* to)
static inline void dp_vector2_copy_from_single(const SPVector2* from, DPVector2* to)
{
to->x1 = x1;
to->x2 = x2;
to->x1 = from->x1;
to->x2 = from->x2;
}
// =================== Reverse ================== //
static inline void sp_vector2_reverse(const SPVector2* from, SPVector2* to)
{
to->x1 = -from->x1;
to->x2 = -from->x2;
}
static inline void dp_vector2_reverse(const DPVector2* from, DPVector2* to)
{
to->x1 = -from->x1;
to->x2 = -from->x2;
}
// ============= Reverse twin type ============== //
static inline void sp_vector2_reverse_double(const DPVector2* from, SPVector2* to)
{
to->x1 = -(float)from->x1;
to->x2 = -(float)from->x2;
}
static inline void dp_vector2_reverse_single(const SPVector2* from, DPVector2* to)
{
to->x1 = -from->x1;
to->x2 = -from->x2;
}
// =================== Module =================== //
@ -114,48 +156,6 @@ static inline int dp_vector2_is_unit(const DPVector2* vector)
return 1.0f - DP_TWO_EPSYLON <= square_module && square_module <= 1.0f + DP_TWO_EPSYLON;
}
// ============= Copy to twin type ============== //
static inline void sp_vector2_copy_to_double(const SPVector2* from, DPVector2* to)
{
to->x1 = (double)from->x1;
to->x2 = (double)from->x2;
}
static inline void dp_vector2_copy_to_single(const DPVector2* from, SPVector2* to)
{
to->x1 = (float)from->x1;
to->x2 = (float)from->x2;
}
// ================= Inversion ================== //
static inline void sp_vector2_invert(SPVector2* vector)
{
vector->x1 = -vector->x1;
vector->x2 = -vector->x2;
}
static inline void dp_vector2_invert(DPVector2* vector)
{
vector->x1 = -vector->x1;
vector->x2 = -vector->x2;
}
// ================ Get Inverted ================ //
static inline void sp_vector2_get_inverted(const SPVector2* vector, SPVector2* result)
{
result->x1 = -vector->x1;
result->x2 = -vector->x2;
}
static inline void dp_vector2_get_inverted(const DPVector2* vector, DPVector2* result)
{
result->x1 = -vector->x1;
result->x2 = -vector->x2;
}
// ==================== Add ===================== //
static inline void sp_vector2_add(const SPVector2* vector1, const SPVector2* vector2, SPVector2* result)