18 const int points_per_segment = std::max(1, resolution);
19 const int eval_num = points_per_segment *
segments_num(points_num, cyclic);
22 return std::max(eval_num, 1);
31 const float t = parameter;
32 const float s = 1.0f - parameter;
35 2.0f + t * t * (3.0f * t - 5.0f),
36 2.0f + s * s * (3.0f * s - 5.0f),
44 const float step = 1.0f / dst.
size();
56template<
typename T,
typename RangeForSegmentFn>
59 const RangeForSegmentFn &range_fn,
68 if (src.
size() == 1) {
75 if (src.
size() == 2) {
106 for (
const int i : range) {
116 const int resolution,
124 [resolution](
const int segment_i) ->
IndexRange {
125 const int points_per_segment = std::max(1, resolution);
126 return {segment_i * points_per_segment, points_per_segment};
141 [evaluated_offsets](
const int segment_i) ->
IndexRange {
142 return evaluated_offsets[segment_i];
149 const int resolution,
153 using T = decltype(dummy);
154 interpolate_to_evaluated(src.typed<T>(), cyclic, resolution, dst.typed<T>());
164 using T = decltype(dummy);
165 interpolate_to_evaluated(src.typed<T>(), cyclic, evaluated_offsets, dst.typed<T>());
Low-level operations for curves.
const CPPType & type() const
constexpr IndexRange drop_back(int64_t n) const
constexpr int64_t last(const int64_t n=0) const
constexpr IndexRange drop_front(int64_t n) const
constexpr int64_t size() const
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr T & first() const
constexpr IndexRange index_range() const
constexpr T & last(const int64_t n=0) const
constexpr const T & first() const
constexpr int64_t size() const
constexpr const T & last(const int64_t n=0) const
constexpr IndexRange index_range() const
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
static void evaluate_segment(const T &a, const T &b, const T &c, const T &d, MutableSpan< T > dst)
T interpolate(const T &a, const T &b, const T &c, const T &d, const float parameter)
int calculate_evaluated_num(int points_num, bool cyclic, int resolution)
float4 calculate_basis(const float parameter)
void interpolate_to_evaluated(GSpan src, bool cyclic, int resolution, GMutableSpan dst)
int segments_num(const int points_num, const bool cyclic)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
VecBase< float, 4 > float4