688{
689 const auto segments = static_cast<size_t>(num_segments);
690
693
694 for (Eigen::Index i = 0; i < num_samples; ++i) {
695 const double t_global = static_cast<double>(i) / static_cast<double>(num_samples - 1);
696 const double segment_float = t_global * static_cast<double>(num_segments);
697 auto seg_idx = static_cast<Eigen::Index>(std::floor(segment_float));
698
699 if (i == num_samples - 1 || seg_idx >= num_segments) {
700 seg_idx = num_segments - 1;
701 }
702
703 const auto s = static_cast<size_t>(seg_idx);
706 }
708 }
709
711
712 for (Eigen::Index seg_idx = 0; seg_idx < num_segments; ++seg_idx) {
713 const auto s = static_cast<size_t>(seg_idx);
715 continue;
716 }
717
720 if (clamp) {
722 }
723
724 for (Eigen::Index off = 0; off <
m_seg_total[s]; off += k_chunk_samples) {
725 m_chunks.push_back({ .segment = seg_idx,
726 .start_col = start_col,
728 .sample_count = std::min(k_chunk_samples,
m_seg_total[s] - off),
729 .clamp_t_high =
clamp });
730 }
731 }
732}
std::vector< Eigen::Index > m_seg_total
std::vector< CurveChunk > m_chunks
std::vector< Eigen::Index > m_seg_first
Eigen::Index m_points_per_segment
void clamp(std::span< double > data, double lo, double hi) noexcept
Clamp values to [lo, hi] in-place.