Небольшие исправления, а также добавление гомогенного трёхмерного вектора

This commit is contained in:
Andrey Pokidov 2026-02-02 20:44:10 +07:00
parent 03627f4401
commit 043cc72c81
25 changed files with 1686 additions and 1644 deletions

View file

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file>
<Workspace title="Workspace">
<Project filename="basic-geometry/basic-geometry.cbp" />
<Project filename="basic-geometry-dev/basic-geometry-dev.cbp">
<Depends filename="basic-geometry/basic-geometry.cbp" />
</Project>
<Project filename="basic-geometry-test/basic-geometry-test.cbp">
<Depends filename="basic-geometry/basic-geometry.cbp" />
</Project>
<Project filename="basic-geometry/basic-geometry.cbp" />
</Workspace>
</CodeBlocks_workspace_file>

View file

@ -51,186 +51,6 @@
</Unit>
<Unit filename="main.h" />
<Unit filename="test_utilities.h" />
<Unit filename="tests/complex.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex.h" />
<Unit filename="tests/complex/complex_copy.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_copy.h" />
<Unit filename="tests/complex/complex_is_unit.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_is_unit.h" />
<Unit filename="tests/complex/complex_is_zero.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_is_zero.h" />
<Unit filename="tests/complex/complex_modulus.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_modulus.h" />
<Unit filename="tests/complex/complex_reset.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_reset.h" />
<Unit filename="tests/complex/complex_set_values.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_set_values.h" />
<Unit filename="tests/complex/complex_swap.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/complex/complex_swap.h" />
<Unit filename="tests/quaternion.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion.h" />
<Unit filename="tests/quaternion/quaternion_copy.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_copy.h" />
<Unit filename="tests/quaternion/quaternion_is_unit.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_is_unit.h" />
<Unit filename="tests/quaternion/quaternion_is_zero.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_is_zero.h" />
<Unit filename="tests/quaternion/quaternion_modulus.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_modulus.h" />
<Unit filename="tests/quaternion/quaternion_reset.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_reset.h" />
<Unit filename="tests/quaternion/quaternion_set_to_identity.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_set_to_identity.h" />
<Unit filename="tests/quaternion/quaternion_set_values.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_set_values.h" />
<Unit filename="tests/quaternion/quaternion_swap.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/quaternion/quaternion_swap.h" />
<Unit filename="tests/utilities.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/utilities.h" />
<Unit filename="tests/utilities/are_close.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/utilities/are_close.h" />
<Unit filename="tests/utilities/is_unit.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/utilities/is_unit.h" />
<Unit filename="tests/utilities/is_zero.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/utilities/is_zero.h" />
<Unit filename="tests/vector2.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2.h" />
<Unit filename="tests/vector2/vector2_copy.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_copy.h" />
<Unit filename="tests/vector2/vector2_is_unit.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_is_unit.h" />
<Unit filename="tests/vector2/vector2_is_zero.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_is_zero.h" />
<Unit filename="tests/vector2/vector2_modulus.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_modulus.h" />
<Unit filename="tests/vector2/vector2_reset.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_reset.h" />
<Unit filename="tests/vector2/vector2_set_values.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_set_values.h" />
<Unit filename="tests/vector2/vector2_swap.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector2/vector2_swap.h" />
<Unit filename="tests/vector3.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3.h" />
<Unit filename="tests/vector3/vector3_copy.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_copy.h" />
<Unit filename="tests/vector3/vector3_is_unit.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_is_unit.h" />
<Unit filename="tests/vector3/vector3_is_zero.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_is_zero.h" />
<Unit filename="tests/vector3/vector3_modulus.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_modulus.h" />
<Unit filename="tests/vector3/vector3_reset.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_reset.h" />
<Unit filename="tests/vector3/vector3_set_values.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_set_values.h" />
<Unit filename="tests/vector3/vector3_swap.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/vector3/vector3_swap.h" />
<Unit filename="tests/versor.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor.h" />
<Unit filename="tests/versor/versor_are_close.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_are_close.h" />
<Unit filename="tests/versor/versor_combine.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_combine.h" />
<Unit filename="tests/versor/versor_copy.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_copy.h" />
<Unit filename="tests/versor/versor_is_identity.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_is_identity.h" />
<Unit filename="tests/versor/versor_reset.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_reset.h" />
<Unit filename="tests/versor/versor_set_values.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_set_values.h" />
<Unit filename="tests/versor/versor_swap.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="tests/versor/versor_swap.h" />
<Unit filename="unity/unity.c">
<Option compilerVar="CC" />
</Unit>

View file

@ -64,6 +64,14 @@
<Option compilerVar="CC" />
</Unit>
<Unit filename="cotes-number.h" />
<Unit filename="hg-vector3.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="hg-vector3.h" />
<Unit filename="matrices.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="matrices.h" />
<Unit filename="matrix2x2.c">
<Option compilerVar="CC" />
</Unit>
@ -80,10 +88,6 @@
<Option compilerVar="CC" />
</Unit>
<Unit filename="matrix3x3.h" />
<Unit filename="matrixes.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="matrixes.h" />
<Unit filename="position2.c">
<Option compilerVar="CC" />
</Unit>

View file

@ -90,7 +90,7 @@ void bgc_fp32_complex_get_exponation(BGC_FP32_Complex* power, const BGC_FP32_Com
{
const float square_modulus = bgc_fp32_complex_get_square_modulus(base);
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON) {
if (square_modulus <= BGC_FP32_SQUARE_EPSILON) {
power->real = 0.0f;
power->imaginary = 0.0f;
return;
@ -110,7 +110,7 @@ void bgc_fp64_complex_get_exponation(BGC_FP64_Complex* power, const BGC_FP64_Com
{
const double square_modulus = bgc_fp64_complex_get_square_modulus(base);
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON) {
if (square_modulus <= BGC_FP64_SQUARE_EPSILON) {
power->real = 0.0;
power->imaginary = 0.0;
return;

View file

@ -70,12 +70,12 @@ inline double bgc_fp64_complex_get_modulus(const BGC_FP64_Complex* number)
inline int bgc_fp32_complex_is_zero(const BGC_FP32_Complex* number)
{
return bgc_fp32_complex_get_square_modulus(number) <= BGC_FP32_SQUARE_EPSYLON;
return bgc_fp32_complex_get_square_modulus(number) <= BGC_FP32_SQUARE_EPSILON;
}
inline int bgc_fp64_complex_is_zero(const BGC_FP64_Complex* number)
{
return bgc_fp64_complex_get_square_modulus(number) <= BGC_FP64_SQUARE_EPSYLON;
return bgc_fp64_complex_get_square_modulus(number) <= BGC_FP64_SQUARE_EPSILON;
}
inline int bgc_fp32_complex_is_unit(const BGC_FP32_Complex* number)
@ -178,7 +178,7 @@ inline int bgc_fp32_complex_normalize(BGC_FP32_Complex* number)
return 1;
}
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@ -198,7 +198,7 @@ inline int bgc_fp64_complex_normalize(BGC_FP64_Complex* number)
return 1;
}
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@ -220,7 +220,7 @@ inline int bgc_fp32_complex_get_normalized(BGC_FP32_Complex* normalized, const B
return 1;
}
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
normalized->real = 0.0f;
normalized->imaginary = 0.0f;
return 0;
@ -244,7 +244,7 @@ inline int bgc_fp64_complex_get_normalized(BGC_FP64_Complex* normalized, const B
return 1;
}
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
normalized->real = 0.0;
normalized->imaginary = 0.0;
return 0;
@ -288,7 +288,7 @@ inline int bgc_fp32_complex_get_inverse(BGC_FP32_Complex* inverse, const BGC_FP3
{
const float square_modulus = bgc_fp32_complex_get_square_modulus(number);
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@ -304,7 +304,7 @@ inline int bgc_fp64_complex_get_inverse(BGC_FP64_Complex* inverse, const BGC_FP6
{
const double square_modulus = bgc_fp64_complex_get_square_modulus(number);
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
return 0;
}
@ -368,7 +368,7 @@ inline void bgc_fp32_complex_subtract(BGC_FP32_Complex* difference, const BGC_FP
difference->imaginary = minuend->imaginary - subtrahend->imaginary;
}
inline void bgc_fp64_complex_subtract(const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* subtrahend, BGC_FP64_Complex* difference)
inline void bgc_fp64_complex_subtract(BGC_FP64_Complex* difference, const BGC_FP64_Complex* minuend, const BGC_FP64_Complex* subtrahend)
{
difference->real = minuend->real - subtrahend->real;
difference->imaginary = minuend->imaginary - subtrahend->imaginary;
@ -414,7 +414,7 @@ inline int bgc_fp32_complex_get_ratio(BGC_FP32_Complex* quotient, const BGC_FP32
{
const float square_modulus = bgc_fp32_complex_get_square_modulus(divisor);
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON) {
if (square_modulus <= BGC_FP32_SQUARE_EPSILON) {
return 0;
}
@ -433,7 +433,7 @@ inline int bgc_fp64_complex_get_ratio(BGC_FP64_Complex* quotient, const BGC_FP64
{
const double square_modulus = bgc_fp64_complex_get_square_modulus(divisor);
if (square_modulus <= BGC_FP64_SQUARE_EPSYLON) {
if (square_modulus <= BGC_FP64_SQUARE_EPSILON) {
return 0;
}
@ -518,11 +518,11 @@ inline int bgc_fp32_complex_are_close(const BGC_FP32_Complex* number1, const BGC
const float square_distance = d_real * d_real + d_imaginary * d_imaginary;
if (square_modulus1 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSYLON_EFFECTIVENESS_LIMIT) {
return square_distance <= BGC_FP32_SQUARE_EPSYLON;
if (square_modulus1 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT) {
return square_distance <= BGC_FP32_SQUARE_EPSILON;
}
return square_distance <= BGC_FP32_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSYLON * square_modulus2;
return square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP32_SQUARE_EPSILON * square_modulus2;
}
inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* number1, const BGC_FP64_Complex* number2)
@ -535,11 +535,11 @@ inline int bgc_fp64_complex_are_close(const BGC_FP64_Complex* number1, const BGC
const double square_distance = d_real * d_real + d_imaginary * d_imaginary;
if (square_modulus1 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSYLON_EFFECTIVENESS_LIMIT) {
return square_distance <= BGC_FP64_SQUARE_EPSYLON;
if (square_modulus1 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT) {
return square_distance <= BGC_FP64_SQUARE_EPSILON;
}
return square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSYLON * square_modulus2;
return square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus1 && square_distance <= BGC_FP64_SQUARE_EPSILON * square_modulus2;
}
#endif

View file

Internal server error - Personal Git Server: Beyond coding. We Forge.

500

Internal server error

Forgejo version: 11.0.1+gitea-1.22.0

@ -62,7 +62,7 @@ void _bgc_fp32_cotes_number_normalize(BGC_FP32_CotesNumber* number)
{
const float square_modulus = number->_cos * number->_cos + number->_sin * number->_sin;
if (square_modulus <= BGC_FP32_SQUARE_EPSYLON || isnan(square_modulus)) {
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {