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

◆ build_interpolated_path()

void MayaFlux::Nodes::GpuSync::TopologyGeneratorNode::build_interpolated_path ( std::span< LineVertex points,
size_t  num_points 
)
private

Definition at line 390 of file TopologyGeneratorNode.cpp.

393{
395
396 m_control_scratch.resize(num_points * 3);
397 for (size_t i = 0; i < num_points; ++i) {
398 m_control_scratch[i * 3 + 0] = points[i].position.x;
399 m_control_scratch[i * 3 + 1] = points[i].position.y;
400 m_control_scratch[i * 3 + 2] = points[i].position.z;
401 }
402
403 const size_t num_segments = num_points - 1;
404 const auto total_samples = static_cast<Eigen::Index>(
405 1 + num_segments * (m_samples_per_segment - 1));
406
408
409 const std::vector<double>* curve = &m_curve_primary;
410
413 total_samples, total_samples, m_curve_secondary);
414 curve = &m_curve_secondary;
415 }
416
417 const auto count = static_cast<size_t>(total_samples);
418 if (count < 2) {
419 return;
420 }
421
422 m_vertices.resize((count - 1) * 2);
423
424 const double* x = curve->data();
425 const double* y = x + count;
426 const double* z = y + count;
427
428 for (size_t i = 0; i + 1 < count; ++i) {
429 m_vertices[i * 2].position = {
430 static_cast<float>(x[i]), static_cast<float>(y[i]), static_cast<float>(z[i])
431 };
432 m_vertices[i * 2 + 1].position = {
433 static_cast<float>(x[i + 1]), static_cast<float>(y[i + 1]), static_cast<float>(z[i + 1])
434 };
435 }
436
437 write_path_attributes(points, num_points);
438}
std::vector< glm::vec2 > * points
size_t count
void reparameterize_planar(std::span< const double > points, size_t dim, Eigen::Index point_count, Eigen::Index num_samples, std::vector< double > &out)
Resample a polyline to uniform arc length, coordinate-major.
void evaluate_planar(std::span< const double > control_points, size_t dim, Eigen::Index num_samples, std::vector< double > &out)
Evaluate a curve into a coordinate-major buffer.
void configure(InterpolationMode mode, double tension)
Re-resolve the kernel.
void write_path_attributes(std::span< const LineVertex > points, size_t num_points)
Write colour and thickness for the interpolated path.
size_t m_samples_per_segment
Controls smoothness vs performance.

References MayaFlux::Kinesis::CurveEvaluator::configure(), count, MayaFlux::Kinesis::CurveEvaluator::evaluate_planar(), m_control_scratch, m_curve_primary, m_curve_secondary, m_evaluator, m_path_interpolation_mode, m_samples_per_segment, m_use_arc_length_reparameterization, m_vertices, points, MayaFlux::Kinesis::CurveEvaluator::reparameterize_planar(), and write_path_attributes().

Referenced by build_vertex_buffer().

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