Skip to content

Conversation

@horizon-blue
Copy link
Contributor

@horizon-blue horizon-blue commented Dec 1, 2025

Closes MET-56

Summary of Changes

This PR implements a PixelCoordRange class, which defines .begin() and .end() methods compliant with C++'s range-expression. Instead of using two Iterator to denote the range, the end() returns a special Sentinel object, which requires less bookkeeping information (e.g. it doesn't need to keep another copy of the pixel start & end location). You can read more about C++20's Iterator Sentinel feature here if interested :).

With this new class, we can now iterating over 2D pixels using range-based for loop (as we wished for in Slack), i.e.,

auto pixel_ranges = PixelCoordRange{ i_start, i_end, j_start, j_end };
for (auto pixel_coords : pixel_ranges)
   // do something

Test Plan

This new pixel coordinate generator replaces the need to have a dedicated Intrinsics.get_ray_directions_kernels method (which is removed in this PR). As such, camera_test.cu has been updated accordingly to show & test that range-based for loop works as expected.

As always, to run the tests:

pixi run ctest

@linear
Copy link

linear bot commented Dec 1, 2025

@horizon-blue
Copy link
Contributor Author

Okay, based on offline discussions, I'm going to merge this now so we can keep moving forward :).

@horizon-blue horizon-blue merged commit 76458d2 into master Dec 2, 2025
1 check passed
@horizon-blue horizon-blue deleted the xiaoyan/pixel-coords branch December 2, 2025 20:21
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.

2 participants