40 return std::make_unique<PolySpline>();
42 return std::make_unique<BezierSpline>();
44 return std::make_unique<NURBSpline>();
74 dst->attributes.reallocate(dst->size());
81 position += translation;
89 position = matrix * position;
97 this->
radii().reverse();
98 this->
tilts().reverse();
108 using T = decltype(dummy);
109 attribute->typed<T>().reverse();
127 return this->
is_cyclic_ ? eval_num : eval_num - 1;
138 const int num = this->
size();
200 return float3(0.0f, 0.0f, 1.0f);
266 const float3 axis_scaled = axis *
dot(direction, axis);
284 r_normals[i] = {1.0f, 0.0f, 0.0f};
296 const float3 &last_tangent,
297 const float3 ¤t_tangent)
328 r_normals[0] = {1.0f, 0.0f, 0.0f};
348 r_normals[0], uncorrected_last_normal,
tangents[0]);
349 if (correction_angle >
M_PI) {
350 correction_angle = correction_angle - 2 *
M_PI;
354 const float angle_step = correction_angle / r_normals.
size();
356 const float angle = angle_step * i;
392 for (
const int i :
normals.index_range()) {
415 const float previous_length = (index == 0) ? 0.0f : lengths[index - 1];
416 const float length_in_segment =
length - previous_length;
417 const float segment_length = lengths[index] - previous_length;
418 const float factor = segment_length == 0.0f ? 0.0f : length_in_segment / segment_length;
431 if (samples_num == 1) {
435 const float total_length = this->
length();
436 const float sample_length = total_length / (samples_num - (
is_cyclic_ ? 0 : 1));
440 float prev_length = 0.0f;
443 const float length = lengths[i_evaluated];
446 while ((sample_length * i_sample) <
length && i_sample < samples_num) {
447 const float factor = (sample_length * i_sample - prev_length) / (
length - prev_length);
448 samples[i_sample] = i_evaluated + factor;
457 for (
const int i :
IndexRange(i_sample, samples_num - i_sample)) {
458 samples[i] =
float(samples_num);
474 if (index_factor < eval_num) {
476 const int next_index = (index < eval_num - 1) ? index + 1 : 0;
477 return LookupResult{index, next_index, index_factor - index};
482 if (index_factor < eval_num - 1) {
484 const int next_index = index + 1;
485 return LookupResult{index, next_index, index_factor - index};
510 using T = decltype(dummy);
511 const VArray<T> src_typed = src.typed<T>();
512 MutableSpan<T> dst_typed = dst.typed<T>();
513 if (src.size() == 1) {
514 dst_typed.fill(src_typed[0]);
518 for (const int i : range) {
519 const LookupResult interp = this->lookup_data_from_index_factor(index_factors[i]);
520 dst_typed[i] = blender::attribute_math::mix2(interp.factor,
521 src_typed[interp.evaluated_index],
522 src_typed[interp.next_evaluated_index]);
typedef float(TangentPoint)[2]
std::unique_ptr< Spline > SplinePtr
#define BLI_assert_unreachable()
#define BLI_ASSERT_UNIT_V3(v)
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
@ NORMAL_MODE_MINIMUM_TWIST
_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 type
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color attribute
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
LookupResult lookup_evaluated_factor(float factor) const
std::mutex tangent_cache_mutex_
virtual void translate(const blender::float3 &translation)
virtual blender::MutableSpan< blender::float3 > positions()=0
std::mutex length_cache_mutex_
virtual blender::MutableSpan< float > tilts()=0
int evaluated_edges_num() const
blender::Span< float > evaluated_lengths() const
SplinePtr copy_without_attributes() const
bool tangent_cache_dirty_
blender::Array< float > sample_uniform_index_factors(int samples_num) const
void set_cyclic(bool value)
virtual void transform(const blender::float4x4 &matrix)
void bounds_min_max(blender::float3 &min, blender::float3 &max, bool use_evaluated) const
blender::Vector< blender::float3 > evaluated_tangents_cache_
std::mutex normal_cache_mutex_
blender::Vector< float > evaluated_lengths_cache_
virtual int size() const =0
virtual int evaluated_points_num() const =0
LookupResult lookup_data_from_index_factor(float index_factor) const
virtual void reverse_impl()=0
blender::Vector< blender::float3 > evaluated_normals_cache_
blender::Span< blender::float3 > evaluated_normals() const
blender::bke::CustomDataAttributes attributes
void sample_with_index_factors(const blender::GVArray &src, blender::Span< float > index_factors, blender::GMutableSpan dst) const
static void copy_base_settings(const Spline &src, Spline &dst)
virtual blender::MutableSpan< float > radii()=0
virtual void mark_cache_invalid()=0
virtual blender::GVArray interpolate_to_evaluated(const blender::GVArray &src) const =0
virtual void copy_settings(Spline &dst) const =0
virtual blender::Span< blender::float3 > evaluated_positions() const =0
LookupResult lookup_evaluated_length(float length) const
blender::Span< blender::float3 > evaluated_tangents() const
SplinePtr copy_only_settings() const
virtual void correct_end_tangents() const =0
virtual void copy_data(Spline &dst) const =0
const T & last(const int64_t n=0) const
constexpr int64_t size() const
constexpr bool is_empty() const
constexpr T & last(const int64_t n=0) const
constexpr IndexRange index_range() const
constexpr const T & last(const int64_t n=0) const
constexpr int64_t size() const
constexpr const T * end() const
constexpr const T * begin() const
constexpr bool is_empty() const
void resize(const int64_t new_size)
std::optional< blender::GMutableSpan > get_for_write(const AttributeIDRef &attribute_id)
bool foreach_attribute(const AttributeForeachCallback callback, eAttrDomain domain) const
SyclQueue void void * src
static bool is_cyclic(const Nurb *nu)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
ccl_device_inline float2 fabs(const float2 &a)
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
T dot(const vec_base< T, Size > &a, const vec_base< T, Size > &b)
vec_base< T, 3 > cross(const vec_base< T, 3 > &a, const vec_base< T, 3 > &b)
T length(const vec_base< T, Size > &a)
T distance(const T &a, const T &b)
vec_base< T, Size > normalize(const vec_base< T, Size > &v)
float3 rotate_direction_around_axis(const float3 &direction, const float3 &axis, float angle)
SymEdge< T > * prev(const SymEdge< T > *se)
void parallel_for(IndexRange range, int64_t grain_size, const Function &function)
vec_base< float, 3 > float3
MutableSpan< float3 > positions
MutableSpan< float3 > tangents
MutableSpan< float3 > normals
static float3 calculate_next_normal(const float3 &last_normal, const float3 &last_tangent, const float3 ¤t_tangent)
static void calculate_normals_z_up(Span< float3 > tangents, MutableSpan< float3 > r_normals)
static SplinePtr create_spline(const CurveType type)
static void calculate_normals_minimum(Span< float3 > tangents, const bool cyclic, MutableSpan< float3 > r_normals)
static float3 rotate_direction_around_axis(const float3 &direction, const float3 &axis, const float angle)
static float3 direction_bisect(const float3 &prev, const float3 &middle, const float3 &next)
static void accumulate_lengths(Span< float3 > positions, const bool is_cyclic, MutableSpan< float > lengths)
static void calculate_tangents(Span< float3 > positions, const bool is_cyclic, MutableSpan< float3 > tangents)