Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg-Olegovich committed May 21, 2024
1 parent d724a99 commit 2f6590d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 2 additions & 6 deletions packages/geom/src/bounding_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@ BoundingBox& BoundingBox::extend(double margin) noexcept {
return *this;
}

inline BoundingBox extend(BoundingBox& box, const geom::Vec2& v) noexcept {
return box.extend(v);
}
inline BoundingBox extend(BoundingBox& box, const geom::Vec2& v) noexcept { return box.extend(v); }

inline BoundingBox extend(BoundingBox& box, double margin) noexcept {
return box.extend(margin);
}
inline BoundingBox extend(BoundingBox& box, double margin) noexcept { return box.extend(margin); }

BoundingBox makeBoundingBox(const Polygon& polygon) noexcept {
VERIFY(!polygon.empty());
Expand Down
6 changes: 4 additions & 2 deletions packages/geom/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ament_add_gtest(${PROJECT_NAME}_tests
ament_add_gtest(
${PROJECT_NAME}_tests
angle_tests.cpp
angle_vector_tests.cpp
arc_tests.cpp
Expand All @@ -9,7 +10,8 @@ ament_add_gtest(${PROJECT_NAME}_tests
ray_tests.cpp
segment_tests.cpp
vector_tests.cpp
vector3_tests.cpp)
vector3_tests.cpp
)
target_link_libraries(${PROJECT_NAME}_tests ${PROJECT_NAME})

set_tests_properties(${Tests} PROPERTIES TIMEOUT 1)
Expand Down
2 changes: 1 addition & 1 deletion packages/geom/test/bounding_box_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST(Vector3, extend) {
const auto v1 = Vec2{7, 4};
const auto v2 = Vec2{-1, -8};
const auto margin = 4;

// Act.
bb1.extend(v1);
bb1.extend(v2);
Expand Down
10 changes: 6 additions & 4 deletions packages/geom/test/vector3_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ TEST(Vector3, len) {
const Vec3 c = {-1, 1, 0};
const Vec3 d = {2, 5, 7};

ASSERT_GEOM_EQUAL(a.len(), std::sqrt(3), 1e-9);
ASSERT_GEOM_EQUAL(b.len(), std::sqrt(3), 1e-9);
ASSERT_GEOM_EQUAL(c.len(), std::sqrt(2), 1e-9);
ASSERT_GEOM_EQUAL(d.len(), std::sqrt(78), 1e-9);
constexpr double eps = 1e-9;

ASSERT_GEOM_EQUAL(a.len(), std::sqrt(3), eps);
ASSERT_GEOM_EQUAL(b.len(), std::sqrt(3), eps);
ASSERT_GEOM_EQUAL(c.len(), std::sqrt(2), eps);
ASSERT_GEOM_EQUAL(d.len(), std::sqrt(78), eps);
}

0 comments on commit 2f6590d

Please sign in to comment.