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

◆ polyline_colored()

MAYAFLUX_API std::vector< Kakshya::LineVertex > MayaFlux::Kinesis::polyline_colored ( std::span< const glm::vec2 >  pts,
std::span< const glm::vec3 >  colors,
float  thickness = 1.F 
)

Polyline with per-vertex colors as a LINE_LIST.

pts and colors must have equal length. Each line segment blends from the color at its start vertex to the color at its end vertex.

Parameters
ptsOrdered path vertices in NDC.
colorsPer-vertex colors. Must match pts in size.
thicknessLine thickness applied uniformly.

Definition at line 303 of file Geometry2D.cpp.

307{
308 if (pts.size() < 2 || colors.size() != pts.size())
309 return {};
310
311 std::vector<Kakshya::LineVertex> out;
312 out.reserve((pts.size() - 1) * 2);
313
314 for (size_t i = 0; i + 1 < pts.size(); ++i) {
315 out.push_back(lvert2(pts[i], colors[i], thickness));
316 out.push_back(lvert2(pts[i + 1], colors[i + 1], thickness));
317 }
318
319 return out;
320}