9 const bool include_last_point,
13 const int count = r_segment_indices.
size();
19 r_segment_indices[0] = 0;
23 const float total_length = lengths.
last();
24 const float step_length = total_length / (
count - include_last_point);
27 for (
const int i : range) {
29 const float sample_length =
std::min(total_length, i * step_length);
30 sample_at_length(lengths, sample_length, r_segment_indices[i], r_factors[i], &hint);
41 std::is_sorted(accumulated_segment_lengths.
begin(), accumulated_segment_lengths.
end()));
50 for (
const int i : range) {
51 const float sample_length = sample_lengths[i];
53 accumulated_segment_lengths, sample_length, r_segment_indices[i], r_factors[i], &hint);
constexpr int64_t size() const
constexpr const T & last(const int64_t n=0) const
constexpr int64_t size() const
constexpr const T * end() const
constexpr const T * begin() const
void sample_at_lengths(Span< float > accumulated_segment_lengths, Span< float > sample_lengths, MutableSpan< int > r_segment_indices, MutableSpan< float > r_factors)
void sample_at_length(const Span< float > accumulated_segment_lengths, const float sample_length, int &r_segment_index, float &r_factor, SampleSegmentHint *hint=nullptr)
void sample_uniform(Span< float > accumulated_segment_lengths, bool include_last_point, MutableSpan< int > r_segment_indices, MutableSpan< float > r_factors)
void parallel_for(IndexRange range, int64_t grain_size, const Function &function)