Переименование методов на распространённые названия
This commit is contained in:
parent
039b26305a
commit
b621191698
14 changed files with 192 additions and 192 deletions
|
|
@ -41,46 +41,46 @@ inline void bgc_fp64_vector3_make(BGC_FP64_Vector3* destination, const double x1
|
|||
|
||||
// ================== Modulus =================== //
|
||||
|
||||
inline float bgc_fp32_vector3_get_square_modulus(const BGC_FP32_Vector3* vector)
|
||||
inline float bgc_fp32_vector3_get_squared_length(const BGC_FP32_Vector3* vector)
|
||||
{
|
||||
return vector->x1 * vector->x1 + vector->x2 * vector->x2 + vector->x3 * vector->x3;
|
||||
}
|
||||
|
||||
inline double bgc_fp64_vector3_get_square_modulus(const BGC_FP64_Vector3* vector)
|
||||
inline double bgc_fp64_vector3_get_squared_length(const BGC_FP64_Vector3* vector)
|
||||
{
|
||||
return vector->x1 * vector->x1 + vector->x2 * vector->x2 + vector->x3 * vector->x3;
|
||||
}
|
||||
|
||||
inline float bgc_fp32_vector3_get_modulus(const BGC_FP32_Vector3* vector)
|
||||
inline float bgc_fp32_vector3_get_length(const BGC_FP32_Vector3* vector)
|
||||
{
|
||||
return sqrtf(bgc_fp32_vector3_get_square_modulus(vector));
|
||||
return sqrtf(bgc_fp32_vector3_get_squared_length(vector));
|
||||
}
|
||||
|
||||
inline double bgc_fp64_vector3_get_modulus(const BGC_FP64_Vector3* vector)
|
||||
inline double bgc_fp64_vector3_get_length(const BGC_FP64_Vector3* vector)
|
||||
{
|
||||
return sqrt(bgc_fp64_vector3_get_square_modulus(vector));
|
||||
return sqrt(bgc_fp64_vector3_get_squared_length(vector));
|
||||
}
|
||||
|
||||
// ================= Comparison ================= //
|
||||
|
||||
inline int bgc_fp32_vector3_is_zero(const BGC_FP32_Vector3* vector)
|
||||
{
|
||||
return bgc_fp32_vector3_get_square_modulus(vector) <= BGC_FP32_SQUARE_EPSILON;
|
||||
return bgc_fp32_vector3_get_squared_length(vector) <= BGC_FP32_SQUARE_EPSILON;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_vector3_is_zero(const BGC_FP64_Vector3* vector)
|
||||
{
|
||||
return bgc_fp64_vector3_get_square_modulus(vector) <= BGC_FP64_SQUARE_EPSILON;
|
||||
return bgc_fp64_vector3_get_squared_length(vector) <= BGC_FP64_SQUARE_EPSILON;
|
||||
}
|
||||
|
||||
inline int bgc_fp32_vector3_is_unit(const BGC_FP32_Vector3* vector)
|
||||
{
|
||||
return bgc_fp32_is_square_unit(bgc_fp32_vector3_get_square_modulus(vector));
|
||||
return bgc_fp32_is_square_unit(bgc_fp32_vector3_get_squared_length(vector));
|
||||
}
|
||||
|
||||
inline int bgc_fp64_vector3_is_unit(const BGC_FP64_Vector3* vector)
|
||||
{
|
||||
return bgc_fp64_is_square_unit(bgc_fp64_vector3_get_square_modulus(vector));
|
||||
return bgc_fp64_is_square_unit(bgc_fp64_vector3_get_squared_length(vector));
|
||||
}
|
||||
|
||||
// ==================== Copy ==================== //
|
||||
|
|
@ -375,7 +375,7 @@ inline void bgc_fp64_vector3_get_reverse(BGC_FP64_Vector3* reverse, const BGC_FP
|
|||
|
||||
inline int bgc_fp32_vector3_normalize(BGC_FP32_Vector3* vector)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_vector3_get_square_modulus(vector);
|
||||
const float square_modulus = bgc_fp32_vector3_get_squared_length(vector);
|
||||
|
||||
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
|
||||
return BGC_FAILURE;
|
||||
|
|
@ -396,7 +396,7 @@ inline int bgc_fp32_vector3_normalize(BGC_FP32_Vector3* vector)
|
|||
|
||||
inline int bgc_fp64_vector3_normalize(BGC_FP64_Vector3* vector)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_vector3_get_square_modulus(vector);
|
||||
const double square_modulus = bgc_fp64_vector3_get_squared_length(vector);
|
||||
|
||||
if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
|
||||
return BGC_FAILURE;
|
||||
|
|
@ -417,7 +417,7 @@ inline int bgc_fp64_vector3_normalize(BGC_FP64_Vector3* vector)
|
|||
|
||||
inline int bgc_fp32_vector3_get_normalized(BGC_FP32_Vector3* normalized, const BGC_FP32_Vector3* vector)
|
||||
{
|
||||
const float square_modulus = bgc_fp32_vector3_get_square_modulus(vector);
|
||||
const float square_modulus = bgc_fp32_vector3_get_squared_length(vector);
|
||||
|
||||
if (square_modulus <= BGC_FP32_SQUARE_EPSILON || isnan(square_modulus)) {
|
||||
bgc_fp32_vector3_reset(normalized);
|
||||
|
|
@ -435,7 +435,7 @@ inline int bgc_fp32_vector3_get_normalized(BGC_FP32_Vector3* normalized, const B
|
|||
|
||||
inline int bgc_fp64_vector3_get_normalized(BGC_FP64_Vector3* normalized, const BGC_FP64_Vector3* vector)
|
||||
{
|
||||
const double square_modulus = bgc_fp64_vector3_get_square_modulus(vector);
|
||||
const double square_modulus = bgc_fp64_vector3_get_squared_length(vector);
|
||||
|
||||
if (square_modulus <= BGC_FP64_SQUARE_EPSILON || isnan(square_modulus)) {
|
||||
bgc_fp64_vector3_reset(normalized);
|
||||
|
|
@ -579,8 +579,8 @@ inline int bgc_fp64_vector3_are_close_enough(const BGC_FP64_Vector3* vector1, co
|
|||
|
||||
inline int bgc_fp32_vector3_are_close(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2)
|
||||
{
|
||||
const float square_modulus1 = bgc_fp32_vector3_get_square_modulus(vector1);
|
||||
const float square_modulus2 = bgc_fp32_vector3_get_square_modulus(vector2);
|
||||
const float square_modulus1 = bgc_fp32_vector3_get_squared_length(vector1);
|
||||
const float square_modulus2 = bgc_fp32_vector3_get_squared_length(vector2);
|
||||
const float square_distance = bgc_fp32_vector3_get_square_distance(vector1, vector2);
|
||||
|
||||
if (square_modulus1 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP32_EPSILON_EFFECTIVENESS_LIMIT) {
|
||||
|
|
@ -592,8 +592,8 @@ inline int bgc_fp32_vector3_are_close(const BGC_FP32_Vector3* vector1, const BGC
|
|||
|
||||
inline int bgc_fp64_vector3_are_close(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2)
|
||||
{
|
||||
const double square_modulus1 = bgc_fp64_vector3_get_square_modulus(vector1);
|
||||
const double square_modulus2 = bgc_fp64_vector3_get_square_modulus(vector2);
|
||||
const double square_modulus1 = bgc_fp64_vector3_get_squared_length(vector1);
|
||||
const double square_modulus2 = bgc_fp64_vector3_get_squared_length(vector2);
|
||||
const double square_distance = bgc_fp64_vector3_get_square_distance(vector1, vector2);
|
||||
|
||||
if (square_modulus1 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT || square_modulus2 <= BGC_FP64_EPSILON_EFFECTIVENESS_LIMIT) {
|
||||
|
|
@ -607,8 +607,8 @@ inline int bgc_fp64_vector3_are_close(const BGC_FP64_Vector3* vector1, const BGC
|
|||
|
||||
inline int bgc_fp32_vector3_are_parallel(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2)
|
||||
{
|
||||
const float square_modulus1 = bgc_fp32_vector3_get_square_modulus(vector1);
|
||||
const float square_modulus2 = bgc_fp32_vector3_get_square_modulus(vector2);
|
||||
const float square_modulus1 = bgc_fp32_vector3_get_squared_length(vector1);
|
||||
const float square_modulus2 = bgc_fp32_vector3_get_squared_length(vector2);
|
||||
|
||||
if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON || square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
|
||||
return 1;
|
||||
|
|
@ -618,13 +618,13 @@ inline int bgc_fp32_vector3_are_parallel(const BGC_FP32_Vector3* vector1, const
|
|||
|
||||
bgc_fp32_vector3_get_cross_product(&product, vector1, vector2);
|
||||
|
||||
return bgc_fp32_vector3_get_square_modulus(&product) <= BGC_FP32_SQUARE_EPSILON * square_modulus1 * square_modulus2;
|
||||
return bgc_fp32_vector3_get_squared_length(&product) <= BGC_FP32_SQUARE_EPSILON * square_modulus1 * square_modulus2;
|
||||
}
|
||||
|
||||
inline int bgc_fp64_vector3_are_parallel(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2)
|
||||
{
|
||||
const double square_modulus1 = bgc_fp64_vector3_get_square_modulus(vector1);
|
||||
const double square_modulus2 = bgc_fp64_vector3_get_square_modulus(vector2);
|
||||
const double square_modulus1 = bgc_fp64_vector3_get_squared_length(vector1);
|
||||
const double square_modulus2 = bgc_fp64_vector3_get_squared_length(vector2);
|
||||
|
||||
if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON || square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
|
||||
return 1;
|
||||
|
|
@ -634,15 +634,15 @@ inline int bgc_fp64_vector3_are_parallel(const BGC_FP64_Vector3* vector1, const
|
|||
|
||||
bgc_fp64_vector3_get_cross_product(&product, vector1, vector2);
|
||||
|
||||
return bgc_fp64_vector3_get_square_modulus(&product) <= BGC_FP64_SQUARE_EPSILON * square_modulus1 * square_modulus2;
|
||||
return bgc_fp64_vector3_get_squared_length(&product) <= BGC_FP64_SQUARE_EPSILON * square_modulus1 * square_modulus2;
|
||||
}
|
||||
|
||||
// ================= Orthogonal ================= //
|
||||
|
||||
inline int bgc_fp32_vector3_are_orthogonal(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2)
|
||||
{
|
||||
const float square_modulus1 = bgc_fp32_vector3_get_square_modulus(vector1);
|
||||
const float square_modulus2 = bgc_fp32_vector3_get_square_modulus(vector2);
|
||||
const float square_modulus1 = bgc_fp32_vector3_get_squared_length(vector1);
|
||||
const float square_modulus2 = bgc_fp32_vector3_get_squared_length(vector2);
|
||||
|
||||
if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON || square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
|
||||
return 1;
|
||||
|
|
@ -655,8 +655,8 @@ inline int bgc_fp32_vector3_are_orthogonal(const BGC_FP32_Vector3* vector1, cons
|
|||
|
||||
inline int bgc_fp64_vector3_are_orthogonal(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2)
|
||||
{
|
||||
const double square_modulus1 = bgc_fp64_vector3_get_square_modulus(vector1);
|
||||
const double square_modulus2 = bgc_fp64_vector3_get_square_modulus(vector2);
|
||||
const double square_modulus1 = bgc_fp64_vector3_get_squared_length(vector1);
|
||||
const double square_modulus2 = bgc_fp64_vector3_get_squared_length(vector2);
|
||||
|
||||
if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON || square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
|
||||
return 1;
|
||||
|
|
@ -671,8 +671,8 @@ inline int bgc_fp64_vector3_are_orthogonal(const BGC_FP64_Vector3* vector1, cons
|
|||
|
||||
inline int bgc_fp32_vector3_get_attitude(const BGC_FP32_Vector3* vector1, const BGC_FP32_Vector3* vector2)
|
||||
{
|
||||
const float square_modulus1 = bgc_fp32_vector3_get_square_modulus(vector1);
|
||||
const float square_modulus2 = bgc_fp32_vector3_get_square_modulus(vector2);
|
||||
const float square_modulus1 = bgc_fp32_vector3_get_squared_length(vector1);
|
||||
const float square_modulus2 = bgc_fp32_vector3_get_squared_length(vector2);
|
||||
|
||||
if (square_modulus1 <= BGC_FP32_SQUARE_EPSILON || square_modulus2 <= BGC_FP32_SQUARE_EPSILON) {
|
||||
return BGC_ATTITUDE_ZERO;
|
||||
|
|
@ -690,7 +690,7 @@ inline int bgc_fp32_vector3_get_attitude(const BGC_FP32_Vector3* vector1, const
|
|||
|
||||
bgc_fp32_vector3_get_cross_product(&product, vector1, vector2);
|
||||
|
||||
if (bgc_fp32_vector3_get_square_modulus(&product) > square_limit) {
|
||||
if (bgc_fp32_vector3_get_squared_length(&product) > square_limit) {
|
||||
return BGC_ATTITUDE_ANY;
|
||||
}
|
||||
|
||||
|
|
@ -699,8 +699,8 @@ inline int bgc_fp32_vector3_get_attitude(const BGC_FP32_Vector3* vector1, const
|
|||
|
||||
inline int bgc_fp64_vector3_get_attitude(const BGC_FP64_Vector3* vector1, const BGC_FP64_Vector3* vector2)
|
||||
{
|
||||
const double square_modulus1 = bgc_fp64_vector3_get_square_modulus(vector1);
|
||||
const double square_modulus2 = bgc_fp64_vector3_get_square_modulus(vector2);
|
||||
const double square_modulus1 = bgc_fp64_vector3_get_squared_length(vector1);
|
||||
const double square_modulus2 = bgc_fp64_vector3_get_squared_length(vector2);
|
||||
|
||||
if (square_modulus1 <= BGC_FP64_SQUARE_EPSILON || square_modulus2 <= BGC_FP64_SQUARE_EPSILON) {
|
||||
return BGC_ATTITUDE_ZERO;
|
||||
|
|
@ -718,7 +718,7 @@ inline int bgc_fp64_vector3_get_attitude(const BGC_FP64_Vector3* vector1, const
|
|||
|
||||
bgc_fp64_vector3_get_cross_product(&product, vector1, vector2);
|
||||
|
||||
if (bgc_fp64_vector3_get_square_modulus(&product) > square_limit) {
|
||||
if (bgc_fp64_vector3_get_squared_length(&product) > square_limit) {
|
||||
return BGC_ATTITUDE_ANY;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue