Skip to content

Move standard geometric functions out of Ray - #1388

Open
aprokop wants to merge 4 commits into
arborx:masterfrom
aprokop:ray_cleanup
Open

Move standard geometric functions out of Ray#1388
aprokop wants to merge 4 commits into
arborx:masterfrom
aprokop:ray_cleanup

Conversation

@aprokop

@aprokop aprokop commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors ray-related geometric operations by moving “standard” functions (e.g., intersects, distance, equals, centroid) out of ArborX::Experimental::Ray’s header-local free functions and into the centralized geometry algorithm dispatch headers, while relocating the associated unit tests into the corresponding geometry test suites.

Changes:

  • Moved ray intersects implementations (ray-box, ray-triangle) into src/geometry/algorithms/ArborX_Intersects.hpp and added corresponding tests to test/tstGeometryIntersects.cpp.
  • Moved ray distance (ray-box) into src/geometry/algorithms/ArborX_Distance.hpp and added corresponding tests to test/tstGeometryDistance.cpp.
  • Added dispatch support for ray equals and centroid, and removed ray-specific test cases from test/tstRay.cpp.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/tstRay.cpp Removes ray intersects/distance test cases; keeps ray intersection/overlapDistance tests (but adds an unused include).
test/tstGeometryIntersects.cpp Adds templated ray-box and ray-triangle intersects test coverage.
test/tstGeometryDistance.cpp Adds templated ray-box distance test coverage.
src/geometry/ArborX_Ray.hpp Removes ray-box/ray-triangle intersects and ray-box distance from this header; relocates traits placement.
src/geometry/algorithms/ArborX_Intersects.hpp Adds dispatch specializations for ray-box and ray-triangle intersects.
src/geometry/algorithms/ArborX_Equals.hpp Adds dispatch specialization for ray-ray equals (currently incorrect).
src/geometry/algorithms/ArborX_Distance.hpp Adds dispatch specialization for ray-box distance and associated documentation comment.
src/geometry/algorithms/ArborX_Centroid.hpp Adds dispatch specialization for ray centroid.
Suppressed comments (1)

src/geometry/algorithms/ArborX_Equals.hpp:82

  • Ray equality calls l.centroid()/r.centroid(), but ArborX::Experimental::Ray does not define a centroid() member (it has origin()). This will not compile and also changes semantics from the previous ray-ray equals implementation.
    return Details::equals(l.centroid(), r.centroid()) &&
           l.direction() == r.direction();

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

}
};

// equals sphere-sphere
{
// Returns the first positive value for t such that ray.origin + t * direction
// intersects the given box. If no such value exists, returns inf.
// Note that this definiton is different from the standard
Comment thread test/tstRay.cpp
Comment on lines 13 to +14
#include <ArborX_Triangle.hpp>
#include <algorithms/ArborX_Intersects.hpp>

@dalg24 dalg24 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the original intent was that the user "opt in" and include the Ray header if he wants to use it, but that it is not considered a basic core geometry.
I don't necessarily have a problem with these changes but I would like you to discuss the rationale for that change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants