Blender
V3.3
|
Namespaces | |
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_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(), blender::Span< T >::first(), blender::Span< T >::last(), blender::MutableSpan< T >::last(), blender::math::length(), segments_num(), blender::Span< T >::size(), and blender::MutableSpan< T >::size().
Referenced by blender::bke::CurvesGeometry::ensure_evaluated_lengths().
|
inline |
Definition at line 71 of file BLI_length_parameterize.hh.
References blender::MutableSpan< T >::index_range(), indices, interpolate_to_masked(), and src.
Referenced by BezierSpline::calculate_segment_insertion(), RGBRampNode::constant_fold(), BezierSpline::ensure_auto_handles(), float_ramp_lookup(), get_next_crossing_from_edge(), blender::geometry::interpolate_position_with_interpolation(), NODE_DEFINE(), rgb_ramp_lookup(), svm_node_rgb_ramp(), and iTaSC::Scene::update().
|
inline |
Definition at line 45 of file BLI_length_parameterize.hh.
References BLI_assert, indices, blender::IndexMask::size(), blender::Span< T >::size(), src, and blender::IndexMask::to_best_mask_type().
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 blender::Span< T >::begin(), BLI_assert, blender::Span< T >::end(), blender::Span< T >::last(), blender::math::safe_divide(), and blender::Span< T >::size().
Referenced by sample_at_lengths(), blender::nodes::node_geo_curve_sample_cc::sample_indices_and_lengths(), and sample_uniform().
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 35 of file length_parameterize.cc.
References blender::Span< T >::begin(), BLI_assert, count, blender::Span< T >::end(), blender::threading::parallel_for(), sample_at_length(), blender::Span< T >::size(), and blender::MutableSpan< T >::size().
Referenced by blender::geometry::interpolate_position_with_interpolation(), blender::ed::sculpt_paint::move_last_point_and_resample(), 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 8 of file length_parameterize.cc.
References blender::Span< T >::begin(), BLI_assert, count, blender::Span< T >::end(), blender::Span< T >::last(), min, blender::threading::parallel_for(), sample_at_length(), blender::Span< T >::size(), and blender::MutableSpan< T >::size().
Referenced by blender::length_parameterize::tests::TEST().
|
inline |
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(), and blender::length_parameterize::tests::calculate_lengths().