|
Blender V4.3
|
Namespaces | |
| namespace | tests |
Classes | |
| struct | SampleSegmentHint |
Functions | |
| int | segments_num (const int points_num, const bool cyclic) |
| template<typename T > | |
| void | accumulate_lengths (const Span< T > values, const bool cyclic, MutableSpan< float > lengths) |
| template<typename T > | |
| void | interpolate_to_masked (const Span< T > src, const Span< int > indices, const Span< float > factors, const IndexMask &dst_mask, MutableSpan< T > dst) |
| template<typename T > | |
| void | interpolate (const Span< T > src, const Span< int > indices, const Span< float > factors, MutableSpan< T > dst) |
| 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 | sample_uniform_reverse (Span< float > accumulated_segment_lengths, bool include_first_point, MutableSpan< int > r_segment_indices, MutableSpan< float > r_factors) |
| void | sample_at_lengths (Span< float > accumulated_segment_lengths, Span< float > sample_lengths, MutableSpan< int > r_segment_indices, MutableSpan< float > r_factors) |
| void blender::length_parameterize::accumulate_lengths | ( | const Span< T > | values, |
| const bool | cyclic, | ||
| MutableSpan< float > | lengths ) |
Accumulate the length of the next segment into each point.
Definition at line 31 of file BLI_length_parameterize.hh.
References BLI_assert, blender::math::distance(), length(), and segments_num().
Referenced by blender::length_parameterize::tests::calculate_lengths(), blender::bke::CurvesGeometry::ensure_evaluated_lengths(), blender::ed::sculpt_paint::greasepencil::morph_points_to_curve(), blender::ed::sculpt_paint::move_last_point_and_resample(), and blender::ed::sculpt_paint::PuffOperationExecutor::puff().
|
inline |
Definition at line 73 of file BLI_length_parameterize.hh.
References blender::MutableSpan< T >::index_range(), and interpolate_to_masked().
Referenced by blender::ed::sculpt_paint::greasepencil::morph_points_to_curve(), blender::ed::sculpt_paint::move_last_point_and_resample(), blender::geometry::resample_to_uniform(), blender::geometry::sample_curve_attribute(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), and blender::length_parameterize::tests::TEST().
|
inline |
Definition at line 47 of file BLI_length_parameterize.hh.
References BLI_assert, blender::Span< T >::first(), blender::index_mask::IndexMask::foreach_segment_optimized(), blender::math::interpolate(), blender::Span< T >::last(), blender::index_mask::IndexMask::size(), and blender::Span< T >::size().
Referenced by interpolate().
|
inline |
| accumulated_segment_lengths | Lengths of individual segments added up. Each value describes the total length at the end of the segment following a point. |
| sample_length | The position to sample at. |
| r_segment_index | Returns the index of the segment that #sample_length is in. |
| r_factor | Returns the position within the segment. |
Definition at line 97 of file BLI_length_parameterize.hh.
References BLI_assert, and blender::math::safe_divide().
Referenced by blender::geometry::lookup_point_bezier(), blender::geometry::lookup_point_polygonal(), blender::geometry::lookup_point_uniform_spacing(), sample_at_lengths(), blender::nodes::node_geo_curve_sample_cc::sample_indices_and_factors_to_compressed(), blender::nodes::node_geo_curve_sample_cc::sample_indices_and_lengths(), sample_uniform(), and sample_uniform_reverse().
| void blender::length_parameterize::sample_at_lengths | ( | Span< float > | accumulated_segment_lengths, |
| Span< float > | sample_lengths, | ||
| MutableSpan< int > | r_segment_indices, | ||
| MutableSpan< float > | r_factors ) |
For each provided sample length, find the segment index and interpolation factor.
| accumulated_segment_lengths | The accumulated lengths of the original elements being sampled. Could be calculated by accumulate_lengths. |
| sample_lengths | Sampled locations in the #lengths array. Must be sorted and is expected to be within the range of the #lengths values. |
| r_segment_indices | The index of the previous point at each sample. |
| r_factors | The portion of the length in each segment at each sample. |
Definition at line 69 of file length_parameterize.cc.
References blender::Span< T >::begin(), BLI_assert, count, blender::Span< T >::end(), blender::threading::parallel_for(), range, sample_at_length(), blender::MutableSpan< T >::size(), and blender::Span< T >::size().
Referenced by blender::ed::sculpt_paint::greasepencil::morph_points_to_curve(), blender::ed::sculpt_paint::move_last_point_and_resample(), blender::length_parameterize::tests::TEST(), and blender::length_parameterize::tests::TEST().
| void blender::length_parameterize::sample_uniform | ( | Span< float > | accumulated_segment_lengths, |
| bool | include_last_point, | ||
| MutableSpan< int > | r_segment_indices, | ||
| MutableSpan< float > | r_factors ) |
Find evenly spaced samples along the lengths.
| accumulated_segment_lengths | The accumulated lengths of the original elements being sampled. Could be calculated by accumulate_lengths. |
| include_last_point | Generally false for cyclic sequences and true otherwise. |
| r_segment_indices | The index of the previous point at each sample. |
| r_factors | The portion of the length in each segment at each sample. |
Definition at line 11 of file length_parameterize.cc.
References blender::Span< T >::begin(), BLI_assert, count, blender::Span< T >::end(), blender::Span< T >::last(), blender::threading::parallel_for(), range, sample_at_length(), blender::MutableSpan< T >::size(), and blender::Span< T >::size().
Referenced by blender::geometry::resample_to_uniform(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), blender::length_parameterize::tests::TEST(), and blender::length_parameterize::tests::TEST().
| void blender::length_parameterize::sample_uniform_reverse | ( | Span< float > | accumulated_segment_lengths, |
| bool | include_first_point, | ||
| MutableSpan< int > | r_segment_indices, | ||
| MutableSpan< float > | r_factors ) |
Find evenly spaced samples along the lengths, starting at the end.
| accumulated_segment_lengths | The accumulated lengths of the original elements being sampled. Could be calculated by accumulate_lengths. |
| include_first_point | Generally false for cyclic sequences and true otherwise. |
| r_segment_indices | The index of the previous point at each sample. |
| r_factors | The portion of the length in each segment at each sample. |
Definition at line 40 of file length_parameterize.cc.
References blender::Span< T >::begin(), BLI_assert, count, blender::Span< T >::end(), blender::Span< T >::last(), blender::threading::parallel_for(), range, sample_at_length(), blender::MutableSpan< T >::size(), and blender::Span< T >::size().
Return the size of the necessary lengths array for a group of points, taking into account the possible last cyclic segment.
Definition at line 22 of file BLI_length_parameterize.hh.
Referenced by accumulate_lengths(), blender::length_parameterize::tests::calculate_lengths(), and blender::ed::sculpt_paint::move_last_point_and_resample().