22 nurbs.resolution_ = resolution_;
23 nurbs.order_ = order_;
29 nurbs.positions_ = positions_;
30 nurbs.weights_ = weights_;
31 nurbs.knots_ = knots_;
32 nurbs.knots_dirty_ = knots_dirty_;
33 nurbs.radii_ = radii_;
34 nurbs.tilts_ = tilts_;
39 const int size = positions_.size();
72 positions_.resize(
size);
120 basis_cache_dirty_ =
true;
121 position_cache_dirty_ =
true;
141 if (this->
size() < order_) {
157 const int num = this->
size() + order_;
164 const int order = order_;
168 const int repeat_inner = is_bezier ?
order - 1 : 1;
171 (is_bezier ?
min_ii(2, repeat_inner) : 1);
180 float current = 0.0f;
197 const int tail_index =
knots.
size() - tail;
210 std::lock_guard
lock{knots_mutex_};
218 knots_dirty_ =
false;
230 const int order = degree + 1;
234 for (
const int i :
IndexRange(num + degree)) {
235 const bool knots_equal = knots[i] == knots[i + 1];
236 if (knots_equal || parameter < knots[i] || parameter > knots[i + 1]) {
247 buffer[end - start] = 1.0f;
249 for (
const int i_order :
IndexRange(2, degree)) {
250 if (end + i_order >= knots.
size()) {
251 end = num + degree - i_order;
253 for (
const int i :
IndexRange(end - start + 1)) {
254 const int knot_index = start + i;
256 float new_basis = 0.0f;
258 new_basis += ((parameter - knots[knot_index]) *
buffer[i]) /
259 (knots[knot_index + i_order - 1] - knots[knot_index]);
262 if (
buffer[i + 1] != 0.0f) {
263 new_basis += ((knots[knot_index + i_order] - parameter) *
buffer[i + 1]) /
264 (knots[knot_index + i_order] - knots[knot_index + 1]);
271 buffer.as_mutable_span().drop_front(end - start + 1).fill(0.0f);
273 r_start_index = start;
278 if (!basis_cache_dirty_) {
282 std::lock_guard
lock{basis_cache_mutex_};
283 if (!basis_cache_dirty_) {
287 const int num = this->
size();
291 const int degree =
order - 1;
306 const int last_control_point_index =
is_cyclic_ ? num + degree : num;
308 const float start =
knots[degree];
309 const float end =
knots[last_control_point_index];
318 parameter, last_control_point_index, degree,
knots, point_weights, basis_start_indices[i]);
321 const int point_index = (basis_start_indices[i] + j) % num;
326 basis_cache_dirty_ =
false;
336 const int num =
src.size();
356 if (
src.is_single()) {
364 using T = decltype(dummy);
365 if constexpr (!std::is_void_v<blender::attribute_math::DefaultMixer<T>>) {
366 Array<T> values(this->evaluated_points_num());
367 interpolate_to_evaluated_impl<T>(basis_cache, this->order(), src.typed<T>(), values);
368 new_varray = VArray<T>::ForContainer(std::move(values));
377 if (!position_cache_dirty_) {
378 return evaluated_position_cache_;
381 std::lock_guard
lock{position_cache_mutex_};
382 if (!position_cache_dirty_) {
383 return evaluated_position_cache_;
387 evaluated_position_cache_.resize(eval_num);
393 position_cache_dirty_ =
false;
394 return evaluated_position_cache_;
MINLINE int min_ii(int a, int b)
@ NURBS_KNOT_MODE_ENDPOINT
@ NURBS_KNOT_MODE_ENDPOINT_BEZIER
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint order
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void reverse_impl() override
void calculate_knots() const
void resize(int size) final
blender::MutableSpan< float > weights()
bool check_valid_num_and_order() const
void copy_data(Spline &dst) const final
blender::MutableSpan< float > tilts() final
blender::MutableSpan< blender::float3 > positions() final
void set_order(uint8_t value)
void mark_cache_invalid() final
blender::Span< float > knots() const
void correct_end_tangents() const final
const BasisCache & calculate_basis_cache() const
blender::MutableSpan< float > radii() final
void set_resolution(int value)
blender::Span< blender::float3 > evaluated_positions() const final
void copy_settings(Spline &dst) const final
blender::GVArray interpolate_to_evaluated(const blender::GVArray &src) const final
int evaluated_points_num() const final
int evaluated_edges_num() const
bool tangent_cache_dirty_
blender::bke::CustomDataAttributes attributes
virtual blender::GVArray interpolate_to_evaluated(const blender::GVArray &src) const =0
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
constexpr void copy_from(Span< T > values)
constexpr IndexRange index_range() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr int64_t size() const
constexpr IndexRange index_range() const
void materialize(MutableSpan< T > r_span) const
Span< T > as_span() const
void resize(const int64_t new_size)
void reallocate(int size)
SyclQueue void void * src
ccl_global float * buffer
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
typename DefaultMixerStruct< T >::type DefaultMixer
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
T clamp(const T &a, const T &min, const T &max)
vec_base< float, 3 > float3
void interpolate_to_evaluated_impl(const NURBSpline::BasisCache &basis_cache, const int order, const blender::VArray< T > &src, MutableSpan< T > dst)
static void calculate_basis_for_point(const float parameter, const int num, const int degree, const Span< float > knots, MutableSpan< float > r_weights, int &r_start_index)
blender::Vector< int > start_indices
blender::Vector< float > weights