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

◆ filled_ring()

MAYAFLUX_API std::vector< Kakshya::Vertex > MayaFlux::Kinesis::filled_ring ( glm::vec2  center,
float  inner_r,
float  outer_r,
uint32_t  segments,
glm::vec3  color = glm::vec3(1.F) 
)

Filled annulus (ring) as a TRIANGLE_LIST quad strip.

Produces two triangles per angular segment between inner_r and outer_r. Minimum segments is 3.

Parameters
centerRing center in NDC.
inner_rInner radius in NDC units.
outer_rOuter radius in NDC units.
segmentsQuad count around the circumference.
colorUniform fill color.

Definition at line 58 of file Geometry2D.cpp.

61{
62 segments = std::max<uint32_t>(segments, k_min_segments);
63 const float step = glm::two_pi<float>() / static_cast<float>(segments);
64
65 std::vector<Kakshya::Vertex> out;
66 out.reserve(static_cast<size_t>(segments) * 6);
67
68 for (uint32_t i = 0; i < segments; ++i) {
69 const float a0 = static_cast<float>(i) * step;
70 const float a1 = static_cast<float>(i + 1) * step;
71
72 const glm::vec2 oi0 = ring_point(center, inner_r, a0);
73 const glm::vec2 oo0 = ring_point(center, outer_r, a0);
74 const glm::vec2 oi1 = ring_point(center, inner_r, a1);
75 const glm::vec2 oo1 = ring_point(center, outer_r, a1);
76
77 out.push_back(vert2(oi0, color));
78 out.push_back(vert2(oo0, color));
79 out.push_back(vert2(oo1, color));
80
81 out.push_back(vert2(oi0, color));
82 out.push_back(vert2(oo1, color));
83 out.push_back(vert2(oi1, color));
84 }
85
86 return out;
87}