Приаведение тангенса (tangent) к единому виду с другими сущностями, добавлено комплексное произведение двумерных векторов

This commit is contained in:
Andrey Pokidov 2024-12-25 13:37:23 +07:00
parent 896c8615f5
commit fcbec62024
5 changed files with 182 additions and 114 deletions

View file

@ -289,11 +289,31 @@ static inline float bg_fp32_vector2_cross_product(const BgFP32Vector2* vector1,
return vector1->x1 * vector2->x2 - vector1->x2 * vector2->x1;
}
static inline double bg_fp64_vector2_cross_product(const BgFP64Vector2* vector1, const BgFP64Vector2* vector2, BgFP64Vector2* result)
static inline double bg_fp64_vector2_cross_product(const BgFP64Vector2* vector1, const BgFP64Vector2* vector2)
{
return vector1->x1 * vector2->x2 - vector1->x2 * vector2->x1;
}
// ============== Complex Product =============== //
static inline void bg_fp32_vector2_complex_product(const BgFP32Vector2* vector1, const BgFP32Vector2* vector2, BgFP32Vector2* result)
{
const float x1 = vector1->x1 * vector2->x1 - vector1->x2 * vector2->x2;
const float x2 = vector1->x1 * vector2->x2 + vector1->x2 * vector2->x1;
result->x1 = x1;
result->x2 = x2;
}
static inline void bg_fp64_vector2_complex_product(const BgFP64Vector2* vector1, const BgFP64Vector2* vector2, BgFP64Vector2* result)
{
const double x1 = vector1->x1 * vector2->x1 - vector1->x2 * vector2->x2;
const double x2 = vector1->x1 * vector2->x2 + vector1->x2 * vector2->x1;
result->x1 = x1;
result->x2 = x2;
}
// =============== Normalization ================ //
static inline int bg_fp32_vector2_normalize(BgFP32Vector2* vector)