TEST: Add getBoundingBox regression tests for node geometries and ImageGeom#1673
Open
jmarquisbq wants to merge 1 commit into
Open
TEST: Add getBoundingBox regression tests for node geometries and ImageGeom#1673jmarquisbq wants to merge 1 commit into
jmarquisbq wants to merge 1 commit into
Conversation
…geGeom Commit a31beeb fixed INodeGeometry0D::getBoundingBox(), which had seeded the upper corner with std::numeric_limits<float>::min() (the smallest positive normal float, ~1.18e-38) instead of lowest(). For any node geometry whose maximum coordinate on an axis was <= ~0, the max corner never updated during the vertex walk, producing a wrong/oversized bounding box. That fix shipped without regression coverage. Add coverage in GeometryTest.cpp: - testNodeGeometryBoundingBox<>() exercises negative-space (the BlueQuartzSoftware#1649 regression), origin-straddling, and positive-space coordinate ranges. It is run against every node geometry (Vertex, Edge, Triangle, Quad, Tetrahedral, Hexahedral), all of which inherit the shared INodeGeometry0D::getBoundingBox(). - An ImageGeom case verifies the independent getBoundingBox()/getBoundingBoxf() grid implementations with a negative origin. The negative-space case was confirmed to fail against the pre-a31beeb code and to pass with the fix in place. Signed-off-by: Jessica Marquis <jessica.marquis@bluequartz.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the regression unit tests that should have accompanied the bounding-box
fix in commit a31beeb / #1649 (
BUG: Fix INodeGeometry0D::getBoundingBox upper-corner initialization).That fix corrected
INodeGeometry0D::getBoundingBox(), which had seeded theupper corner with
std::numeric_limits<float>::min()— the smallest positivenormal float (~1.18e-38) — instead of
std::numeric_limits<float>::lowest().For any node geometry whose maximum coordinate on an axis was
<= ~0(e.g. amesh centered at or below the origin), the max corner never updated during the
vertex walk, producing a wrong/oversized bounding box. Geometries lying entirely
in positive space happened to work, which masked the bug. The fix shipped
without any test coverage, so this PR closes that gap.
Changes
All changes are in
test/GeometryTest.cpp:testNodeGeometryBoundingBox<>()— a templated helper that exercises threecoordinate regimes against the shared
INodeGeometry0D::getBoundingBox():TEST_CASE("Node geometry getBoundingBox handles negative coordinates")—runs the helper against every node geometry that inherits the method:
VertexGeom,EdgeGeom,TriangleGeom,QuadGeom,TetrahedralGeom,HexahedralGeom.TEST_CASE("ImageGeom getBoundingBox handles a negative origin")— therelated grid geometry, which has its own independent implementation. Verifies
both
getBoundingBox()(float64) andgetBoundingBoxf()(float32) with anegative origin (max-Y lands exactly on 0, the boundary case).
RectGridGeomhas nogetBoundingBox()of its own, so it needs no coverage here.Verification
(
getMaxPoint()returns ~0 instead of the least-negative coordinate) andpasses with the fix in place.
GeometryTest.cppsuite passes: 270 assertions across 14 test cases.Unit Testing
across negative / origin-straddling / positive coordinate ranges)
this covers a geometry accessor)
Code Cleanup