MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kinesis::HitRegion< Point, Box > Struct Template Reference

A region a point can hit: fast reject bounds, an authoritative containment test, and an optional clip. More...

#include <HitRegion.hpp>

Inheritance diagram for MayaFlux::Kinesis::HitRegion< Point, Box >:
Collaboration diagram for MayaFlux::Kinesis::HitRegion< Point, Box >:

Public Member Functions

bool hits (Point p) const
 Whether a point hits this region.

Static Public Member Functions

static bool test (const std::optional< Box > &clip, const std::optional< Box > &bounds, const std::function< bool(Point)> &contains, Point p)
 hits() over three parts held elsewhere, without copying them.

Public Attributes

std::optional< Box > bounds
 Fast reject box; must circumscribe contains when both are set.
std::optional< Box > clip
 Region outside which nothing hits, regardless of the other parts.
std::function< bool(Point)> contains
 Authoritative containment test.

Detailed Description

template<typename Point, typename Box>
struct MayaFlux::Kinesis::HitRegion< Point, Box >

A region a point can hit: fast reject bounds, an authoritative containment test, and an optional clip.

The three parts are independent, so any bounds function composes with any box. hits() applies them in one fixed order:

  • a point outside clip never hits;
  • a point outside bounds never hits, so bounds must circumscribe contains;
  • contains, when set, decides;
  • otherwise bounds alone decides, and a region with neither never hits.

Dimension aliases follow the box family: HitRegion1D with AABB1D over a scalar coordinate, HitRegion2D with AABB2D, HitRegion3D with AABB3D.

Usage:

.bounds = AABB2D::from_ndc({ 0.0F, 0.0F }, { 0.3F, 0.3F }),
.contains = circular_bounds({ 0.0F, 0.0F }, 0.3F),
};
bool inside = disc.hits({ 0.1F, 0.1F });
std::function< bool(glm::vec2)> circular_bounds(glm::vec2 center, float radius) noexcept
Containment test for a circle.
Definition Bounds.hpp:283
HitRegion< glm::vec2, AABB2D > HitRegion2D
Definition HitRegion.hpp:71
static AABB2D from_ndc(glm::vec2 center, glm::vec2 half) noexcept
Definition Bounds.hpp:94
std::function< bool(Point)> contains
Authoritative containment test.
Definition HitRegion.hpp:40
bool hits(Point p) const
Whether a point hits this region.
Definition HitRegion.hpp:46
Template Parameters
PointCoordinate type: double, glm::vec2 or glm::vec3.
BoxBox type with contains(Point), as AABB1D, AABB2D and AABB3D have.

Definition at line 35 of file HitRegion.hpp.


The documentation for this struct was generated from the following file: