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

◆ containment_of()

Containment MayaFlux::Portal::Forma::containment_of ( std::span< const glm::vec2 > positions,
Graphics::PrimitiveTopology topology )
inlinenodiscard

Hit region derived from placed vertex positions.

Triangle topologies hit inside any non-degenerate triangle. Other topologies get the circumscribing box as bounds only. In both cases the box of all positions is the bounds.

Parameters
positionsPlaced positions in NDC.
topologyPrimitive topology the positions are drawn with.

Definition at line 65 of file Containment.hpp.

67{
68 Containment hit;
69 if (positions.empty())
70 return hit;
71 hit.bounds = Kinesis::aabb(positions);
72
73 using Topology = Graphics::PrimitiveTopology;
74 std::vector<glm::vec2> triangles;
75 if (topology == Topology::TRIANGLE_LIST) {
76 triangles.assign(positions.begin(), positions.end());
77 } else if (topology == Topology::TRIANGLE_STRIP) {
78 for (size_t i = 0; i + 2 < positions.size(); ++i)
79 triangles.insert(triangles.end(), { positions[i], positions[i + 1], positions[i + 2] });
80 } else if (topology == Topology::TRIANGLE_FAN) {
81 for (size_t i = 1; i + 1 < positions.size(); ++i)
82 triangles.insert(triangles.end(), { positions[0], positions[i], positions[i + 1] });
83 }
84 if (!triangles.empty())
86 return hit;
87}
std::function< bool(glm::vec2)> triangle_list_bounds(std::span< const glm::vec2 > positions)
Containment test for a triangle list: inside any triangle.
Definition Bounds.hpp:535
AABB3D aabb(std::span< T > pts) noexcept
Axis-aligned bounding box of a PositionCarrying span.
Kinesis::HitRegion2D Containment
The spatial fields of an Element as one value: Kinesis::HitRegion2D.
PrimitiveTopology
Vertex assembly primitive topology.
std::function< bool(Point)> contains
Authoritative containment test.
Definition HitRegion.hpp:40
std::optional< Box > bounds
Fast reject box; must circumscribe contains when both are set.
Definition HitRegion.hpp:37

References MayaFlux::Kinesis::aabb(), MayaFlux::Kinesis::HitRegion< Point, Box >::bounds, MayaFlux::Kinesis::HitRegion< Point, Box >::contains, and MayaFlux::Kinesis::triangle_list_bounds().

Referenced by MayaFlux::Portal::Forma::PolygonFactory::operator()(), and vertex_form().

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