|
20 | 20 |
|
21 | 21 | #include <algorithm> |
22 | 22 | #include <array> |
| 23 | +#include <functional> |
23 | 24 | #include <set> |
24 | 25 | #include <string> |
25 | 26 | #include <vector> |
@@ -233,17 +234,38 @@ class IndexGrid { |
233 | 234 | /// These are the cast parameters - copied from constructor |
234 | 235 | std::array<AxisDirection, grid_type::DIM> casts{}; |
235 | 236 |
|
236 | | - /// A transform to be applied to the position |
237 | | - Transform3 transform = Transform3::Identity(); |
| 237 | + /// Abrivation of the delegate to transform the |
| 238 | + /// external point into the grid's coordinate system |
| 239 | + using Delegate_t = |
| 240 | + std::function<const Transform3&(const GeometryContext& gctx)>; |
238 | 241 |
|
239 | | - /// @brief Constructor for a grid based surface attacher |
| 242 | + /// Delegate to transform the external points into the grid's |
| 243 | + /// coordinate system |
| 244 | + Delegate_t toLocalFrame = nullptr; |
| 245 | + |
| 246 | + /// Constructor for a grid based surface attacher |
240 | 247 | /// @param igrid the grid that is moved into this attacher |
241 | 248 | /// @param icasts is the cast values array |
242 | 249 | /// @param itr a transform applied to the global position |
243 | 250 | IndexGrid(grid_type&& igrid, |
244 | 251 | const std::array<AxisDirection, grid_type::DIM>& icasts, |
245 | 252 | const Transform3& itr = Transform3::Identity()) |
246 | | - : grid(std::move(igrid)), casts(icasts), transform(itr) {} |
| 253 | + : grid{std::move(igrid)}, |
| 254 | + casts{icasts}, |
| 255 | + toLocalFrame{ |
| 256 | + [itr](const GeometryContext& /*gctx*/) -> const Transform3& { |
| 257 | + return itr; |
| 258 | + }} {} |
| 259 | + /// Constructor for a grid based surface attacher with alignable delegate |
| 260 | + /// @param igrid the grid that is moved into this attacher |
| 261 | + /// @param icasts is the cast values array |
| 262 | + /// @param trfFunc a transform applied to the global position |
| 263 | + IndexGrid(grid_type&& igrid, |
| 264 | + const std::array<AxisDirection, grid_type::DIM>& icasts, |
| 265 | + Delegate_t trfFunc) |
| 266 | + : grid{std::move(igrid)}, |
| 267 | + casts{icasts}, |
| 268 | + toLocalFrame{std::move(trfFunc)} {} |
247 | 269 |
|
248 | 270 | IndexGrid() = delete; |
249 | 271 | }; |
@@ -299,7 +321,7 @@ struct IndexGridFiller { |
299 | 321 | // Cast the transform according to the grid binning |
300 | 322 | gridQueries.push_back( |
301 | 323 | GridAccessHelpers::castPosition<decltype(iGrid.grid)>( |
302 | | - iGrid.transform * ref, iGrid.casts)); |
| 324 | + iGrid.toLocalFrame(gctx) * ref, iGrid.casts)); |
303 | 325 | } |
304 | 326 | ACTS_DEBUG(gridQueries.size() << " reference points generated."); |
305 | 327 | // These are now in the grid frame, can be expanded |
|
0 commit comments