18 const int eval_num = resolution *
segments_num(points_num, cyclic);
21 return std::max(eval_num, 1);
30 const float t = parameter;
31 const float s = 1.0f - parameter;
34 2.0f + t * t * (3.0f * t - 5.0f),
35 2.0f + s * s * (3.0f * s - 5.0f),
43 const float step = 1.0f / dst.
size();
55template<
typename T,
typename RangeForSegmentFn>
58 const RangeForSegmentFn &range_fn,
67 if (src.
size() == 1) {
74 if (src.
size() == 2) {
105 for (
const int i :
range) {
115 const int resolution,
123 [resolution](
const int segment_i) ->
IndexRange {
124 return {segment_i * resolution, resolution};
139 [evaluated_offsets](
const int segment_i) ->
IndexRange {
140 return evaluated_offsets[segment_i];
147 const int resolution,
151 using T = decltype(dummy);
152 interpolate_to_evaluated(src.typed<T>(), cyclic, resolution, dst.typed<T>());
162 using T = decltype(dummy);
163 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
local_group_size(16, 16) .push_constant(Type b
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))