Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-05-07 23:37:06 +0300
committerHans Goudey <h.goudey@me.com>2021-05-07 23:37:06 +0300
commit3185084efbe493bf232fb0de62b341ae2a2e2936 (patch)
treeb1c32e8646cfe9147801cdc1160cd4293db0ea97 /source/blender/blenkernel/BKE_spline.hh
parent960535ddf3446204dbfcc0f23040bdb74f7a9720 (diff)
Geometry Noes: Curve Resample Node
This node generates a naturally parametarized (even length edge) poly spline version of every spline in the input. There are two modes, "Count", and "Length". These are similar to the same options for the line primitive node in end points mode. I implemented this instead of a "Sample Points" node, because for this operation it's trivial to keep the result as a curve, which is nice since it increases flexibility, and because it can make instancing simpler, i.e. using the transforms of each evaluated point rather than requiring the construction of a "rotation" attribute. Differential Revision: https://developer.blender.org/D11173
Diffstat (limited to 'source/blender/blenkernel/BKE_spline.hh')
-rw-r--r--source/blender/blenkernel/BKE_spline.hh7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh
index 098abf6de65..fda603d57bf 100644
--- a/source/blender/blenkernel/BKE_spline.hh
+++ b/source/blender/blenkernel/BKE_spline.hh
@@ -113,6 +113,7 @@ class Spline {
bool is_cyclic() const;
void set_cyclic(const bool value);
+ virtual void resize(const int size) = 0;
virtual blender::MutableSpan<blender::float3> positions() = 0;
virtual blender::Span<blender::float3> positions() const = 0;
virtual blender::MutableSpan<float> radii() = 0;
@@ -163,6 +164,9 @@ class Spline {
LookupResult lookup_evaluated_factor(const float factor) const;
LookupResult lookup_evaluated_length(const float length) const;
+ blender::Array<float> sample_uniform_index_factors(const int samples_size) const;
+ LookupResult lookup_data_from_index_factor(const float index_factor) const;
+
/**
* Interpolate a virtual array of data with the size of the number of control points to the
* evaluated points. For poly splines, the lifetime of the returned virtual array must not
@@ -248,6 +252,7 @@ class BezierSpline final : public Spline {
const float radius,
const float tilt);
+ void resize(const int size) final;
blender::MutableSpan<blender::float3> positions() final;
blender::Span<blender::float3> positions() const final;
blender::MutableSpan<float> radii() final;
@@ -387,6 +392,7 @@ class NURBSpline final : public Spline {
bool check_valid_size_and_order() const;
int knots_size() const;
+ void resize(const int size) final;
blender::MutableSpan<blender::float3> positions() final;
blender::Span<blender::float3> positions() const final;
blender::MutableSpan<float> radii() final;
@@ -441,6 +447,7 @@ class PolySpline final : public Spline {
void add_point(const blender::float3 position, const float radius, const float tilt);
+ void resize(const int size) final;
blender::MutableSpan<blender::float3> positions() final;
blender::Span<blender::float3> positions() const final;
blender::MutableSpan<float> radii() final;