Skip to content

Commit

Permalink
Test new functionality and bug fix in BoundingBox API center() function
Browse files Browse the repository at this point in the history
  • Loading branch information
nyoungbq committed Jan 3, 2024
1 parent 3078a67 commit a73db8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ TEST_CASE("SimplnxCore::SetImageGeomOriginScalingFilter: 0,0,0 Central Origin",

args.insert(SetImageGeomOriginScalingFilter::k_ImageGeomPath_Key, std::make_any<DataPath>(k_ImageGeomPath));
args.insert(SetImageGeomOriginScalingFilter::k_ChangeOrigin_Key, std::make_any<bool>(k_ChangeOrigin));
args.insert(SetImageGeomOriginScalingFilter::k_CenterOrigin_Key, std::make_any<bool>(false));
args.insert(SetImageGeomOriginScalingFilter::k_CenterOrigin_Key, std::make_any<bool>(true));
args.insert(SetImageGeomOriginScalingFilter::k_ChangeResolution_Key, std::make_any<bool>(k_ChangeResolution));
args.insert(SetImageGeomOriginScalingFilter::k_Origin_Key, std::make_any<std::vector<float64>>(k_Origin));
args.insert(SetImageGeomOriginScalingFilter::k_Spacing_Key, std::make_any<std::vector<float64>>(k_Spacing));
Expand All @@ -84,8 +84,7 @@ TEST_CASE("SimplnxCore::SetImageGeomOriginScalingFilter: 0,0,0 Central Origin",
SIMPLNX_RESULT_REQUIRE_VALID(result.result);

auto& imageGeom = dataStructure.getDataRefAs<ImageGeom>(k_ImageGeomPath);
Point3Df center = imageGeom.getBoundingBoxf().center();
REQUIRE(center == Point3Df{0.0f, 0.0f, 0.0f});
REQUIRE(imageGeom.getBoundingBoxf().center() == Point3Df{0.0f, 0.0f, 0.0f});
REQUIRE(imageGeom.getSpacing() == FloatVec3{2, 2, 2});
}

Expand Down Expand Up @@ -115,7 +114,6 @@ TEST_CASE("SimplnxCore::SetImageGeomOriginScalingFilter: Custom Central Origin",
SIMPLNX_RESULT_REQUIRE_VALID(result.result);

auto& imageGeom = dataStructure.getDataRefAs<ImageGeom>(k_ImageGeomPath);
Point3Df center = imageGeom.getBoundingBoxf().center();
REQUIRE(center == Point3Df{7.0, 6.0, 5.0});
REQUIRE(imageGeom.getBoundingBoxf().center() == Point3Df{7.0, 6.0, 5.0});
REQUIRE(imageGeom.getSpacing() == FloatVec3{2, 2, 2});
}
2 changes: 1 addition & 1 deletion src/simplnx/Common/BoundingBox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class BoundingBox
*/
PointType center() const
{
return {(m_Lower + sideLengths()) / static_cast<ValueType>(2.0)};
return {m_Lower + (sideLengths() / static_cast<ValueType>(2.0))};
}

/**
Expand Down

0 comments on commit a73db8b

Please sign in to comment.