16 const bool include_last_point,
20 const int count = r_segment_indices.
size();
24 std::is_sorted(accumulated_segment_lengths.
begin(), accumulated_segment_lengths.
end()));
27 r_segment_indices[0] = 0;
31 const float total_length = accumulated_segment_lengths.
last();
32 const float step_length = total_length / (
count - include_last_point);
35 for (
const int i : range) {
37 const float sample_length = std::min(total_length,
i * step_length);
39 accumulated_segment_lengths, sample_length, r_segment_indices[
i], r_factors[
i], &hint);
45 const bool include_first_point,
49 const int count = r_segment_indices.
size();
53 std::is_sorted(accumulated_segment_lengths.
begin(), accumulated_segment_lengths.
end()));
56 r_segment_indices[0] = accumulated_segment_lengths.
size() - 1;
60 const float total_length = accumulated_segment_lengths.
last();
61 const float step_length = total_length / (
count - include_first_point);
64 for (
const int i : range) {
66 const float sample_length = std::max(0.0f, total_length -
i * step_length);
68 accumulated_segment_lengths, sample_length, r_segment_indices[
i], r_factors[
i], &hint);
79 std::is_sorted(accumulated_segment_lengths.
begin(), accumulated_segment_lengths.
end()));
88 for (
const int i : range) {
89 const float sample_length = sample_lengths[
i];
91 accumulated_segment_lengths, sample_length, r_segment_indices[
i], r_factors[
i], &hint);
constexpr int64_t size() const
constexpr int64_t size() const
constexpr const T & last(const int64_t n=0) 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_uniform_reverse(Span< float > accumulated_segment_lengths, bool include_first_point, 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(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))