MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ regions_intersect()

bool MayaFlux::Kakshya::regions_intersect ( const Region r1,
const Region r2 
)
noexcept

Test whether two N-dimensional regions overlap on every shared axis.

Regions are treated as closed intervals. Only axes present in both regions are tested; regions with fewer than 2 coordinates on either side are never considered intersecting.

Parameters
r1First region.
r2Second region.
Returns
true if all shared axes of r1 and r2 overlap.

Definition at line 415 of file RegionUtils.cpp.

416{
417 const size_t ndim = std::min({ r1.start_coordinates.size(),
418 r1.end_coordinates.size(),
419 r2.start_coordinates.size(),
420 r2.end_coordinates.size() });
421 if (ndim < 2)
422 return false;
423
424 for (size_t i = 0; i < ndim; ++i) {
425 if (r1.end_coordinates[i] < r2.start_coordinates[i]
426 || r2.end_coordinates[i] < r1.start_coordinates[i])
427 return false;
428 }
429 return true;
430}
std::vector< uint64_t > end_coordinates
Ending frame index (inclusive)
Definition Region.hpp:72
std::vector< uint64_t > start_coordinates
Starting frame index (inclusive)
Definition Region.hpp:69

References regions_intersect().

Referenced by MayaFlux::Kakshya::WindowContainer::get_region_data(), and regions_intersect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: