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

◆ radial()

MAYAFLUX_API GeometryFn< float > MayaFlux::Portal::Forma::Geometry::radial ( glm::vec2  center,
float  radius,
float  angle_start,
float  angle_end,
glm::vec3  color = glm::vec3(0.9F) 
)

Geometry function for a radial indicator in NDC space.

Parameters
centerArc center in NDC.
radiusArc radius in NDC units.
angle_startStart angle in radians (value = 0).
angle_endEnd angle in radians (value = 1).
colorLine color.

Definition at line 61 of file Geometry.cpp.

67{
68 return [center, radius, angle_start, angle_end, color](
69 float v, std::vector<uint8_t>& out, Element& el) {
70 float angle = angle_start + v * (angle_end - angle_start);
71 glm::vec2 tip = center + radius * glm::vec2(std::cos(angle), std::sin(angle));
72
73 using V = Kakshya::LineVertex;
74 std::vector<V> verts = {
75 { .position = { center.x, center.y, 0 }, .color = color },
76 { .position = { tip.x, tip.y, 0 }, .color = color },
77 };
78
79 write_verts(out, verts);
80
81 el.bounds_hint = Kinesis::AABB2D::from_ndc(center, glm::vec2(radius));
82 el.contains = Kinesis::circular_bounds(center, radius);
83 };
84}
void write_verts(std::vector< uint8_t > &out, const std::vector< V > &verts)
Write a vertex array into a GeometryFn output buffer.
Definition Geometry.hpp:35
Vertex type for line primitives (LINE_LIST / LINE_STRIP topology)
A bounded, renderable region on a window surface.
Definition Element.hpp:58

References MayaFlux::Kinesis::circular_bounds(), MayaFlux::Kinesis::AABB2D::from_ndc(), MayaFlux::Kakshya::LineVertex::position, and write_verts().

+ Here is the call graph for this function: