Compare commits

..

No commits in common. "452805333410c5d65f7f2bbdc059b994098fc721" and "5f33fedae4b49f2392ddd48cd8d4c89aa8bf6326" have entirely different histories.

3 changed files with 7 additions and 69 deletions

View file

@ -6,7 +6,7 @@ set(SC_3D_CollisionDetectionHelpers_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/src/sc_
add_library(SC_3D_CollisionDetectionHelpers ${SC_3D_CollisionDetectionHelpers_SOURCES})
set_target_properties(SC_3D_CollisionDetectionHelpers PROPERTIES VERSION 2.2.1 SOVERSION 2)
set_target_properties(SC_3D_CollisionDetectionHelpers PROPERTIES VERSION 2.2.0 SOVERSION 2)
target_compile_features(SC_3D_CollisionDetectionHelpers PUBLIC cxx_std_20)
if(NOT DEFINED CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "")

View file

@ -1,9 +1,5 @@
# Changelog
## Version 2.2.1
Fix UnitTest for checking AABB.
## Version 2.2.0
Refactoring of internally used function.

View file

@ -688,70 +688,12 @@ int main() {
SC_SACD_AABB_Box b{-3.0F, -3.0F, -3.0F, 2.0F, 2.0F, 2.0F};
auto combined = SC_SACD_AABB_Combine(a, b);
auto *box_min = a.x - a.width / 2.0F < b.x - b.width / 2.0F ? &a : &b;
auto *box_max = a.x + a.width / 2.0F > b.x + b.width / 2.0F ? &a : &b;
CHECK_FLOAT(combined.width, box_max->x + box_max->width / 2.0F -
(box_min->x - box_min->width / 2.0F));
CHECK_FLOAT(combined.x, box_min->x - box_min->width / 2.0F +
(box_max->x + box_max->width / 2.0F -
(box_min->x - box_min->width / 2.0F)) /
2.0F);
box_min = a.y - a.height / 2.0F < b.y - b.height / 2.0F ? &a : &b;
box_max = a.y + a.height / 2.0F > b.y + b.height / 2.0F ? &a : &b;
CHECK_FLOAT(combined.height, box_max->y + box_max->height / 2.0F -
(box_min->y - box_min->height / 2.0F));
CHECK_FLOAT(combined.y, box_min->y - box_min->height / 2.0F +
(box_max->y + box_max->height / 2.0F -
(box_min->y - box_min->height / 2.0F)) /
2.0F);
box_min = a.z - a.depth / 2.0F < b.z - b.depth / 2.0F ? &a : &b;
box_max = a.z + a.depth / 2.0F > b.z + b.depth / 2.0F ? &a : &b;
CHECK_FLOAT(combined.depth, box_max->z + box_max->depth / 2.0F -
(box_min->z - box_min->depth / 2.0F));
CHECK_FLOAT(combined.z, box_min->z - box_min->depth / 2.0F +
(box_max->z + box_max->depth / 2.0F -
(box_min->z - box_min->depth / 2.0F)) /
2.0F);
a.x = -12.0F;
a.z = -1.0F;
a.width = 1.0F;
a.height = 5.0F;
a.depth = 0.5F;
b.x = 1.0F;
b.y = 7.0F;
b.width = 3.0F;
b.height = 4.0F;
b.depth = 0.7F;
combined = SC_SACD_AABB_Combine(a, b);
box_min = a.x - a.width / 2.0F < b.x - b.width / 2.0F ? &a : &b;
box_max = a.x + a.width / 2.0F > b.x + b.width / 2.0F ? &a : &b;
CHECK_FLOAT(combined.width, box_max->x + box_max->width / 2.0F -
(box_min->x - box_min->width / 2.0F));
CHECK_FLOAT(combined.x, box_min->x - box_min->width / 2.0F +
(box_max->x + box_max->width / 2.0F -
(box_min->x - box_min->width / 2.0F)) /
2.0F);
box_min = a.y - a.height / 2.0F < b.y - b.height / 2.0F ? &a : &b;
box_max = a.y + a.height / 2.0F > b.y + b.height / 2.0F ? &a : &b;
CHECK_FLOAT(combined.height, box_max->y + box_max->height / 2.0F -
(box_min->y - box_min->height / 2.0F));
CHECK_FLOAT(combined.y, box_min->y - box_min->height / 2.0F +
(box_max->y + box_max->height / 2.0F -
(box_min->y - box_min->height / 2.0F)) /
2.0F);
box_min = a.z - a.depth / 2.0F < b.z - b.depth / 2.0F ? &a : &b;
box_max = a.z + a.depth / 2.0F > b.z + b.depth / 2.0F ? &a : &b;
CHECK_FLOAT(combined.depth, box_max->z + box_max->depth / 2.0F -
(box_min->z - box_min->depth / 2.0F));
CHECK_FLOAT(combined.z, box_min->z - box_min->depth / 2.0F +
(box_max->z + box_max->depth / 2.0F -
(box_min->z - box_min->depth / 2.0F)) /
2.0F);
CHECK_FLOAT(combined.x, (7.0F - 5.0F) / 2.0F);
CHECK_FLOAT(combined.y, (7.0F - 5.0F) / 2.0F);
CHECK_FLOAT(combined.z, (7.0F - 5.0F) / 2.0F);
CHECK_FLOAT(combined.width, 10.0F);
CHECK_FLOAT(combined.height, 10.0F);
CHECK_FLOAT(combined.depth, 10.0F);
}
std::cout << "Checks checked: " << checks_checked << '\n'