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-07-14 22:13:17 +0300
committerHans Goudey <h.goudey@me.com>2021-07-14 22:13:17 +0300
commit093074aefe87259882b56a911d8eeb311408ff14 (patch)
tree1154a979779d5160854f861ca143bd3d7dad8fb8 /source/blender/blenkernel/BKE_spline.hh
parent2829caa9f882f1aa6e716fa0118839ac7057fa88 (diff)
Bezier Spline: Add a more generalized insertion utility
This logic is from the curve sundivide node, used to add points with proper handles in between two existing points. However, the same logic is used for trimming of Bezier splines, and possibly interactive point insertion in the future, so it's helpful as a general utility. The logic is converted to depend on a bezier spline instead of being static. A temporary segment spline can be used for the latter use case.
Diffstat (limited to 'source/blender/blenkernel/BKE_spline.hh')
-rw-r--r--source/blender/blenkernel/BKE_spline.hh12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh
index 1aac2e311e3..f85e62768f7 100644
--- a/source/blender/blenkernel/BKE_spline.hh
+++ b/source/blender/blenkernel/BKE_spline.hh
@@ -337,6 +337,18 @@ class BezierSpline final : public Spline {
blender::MutableSpan<blender::float3> positions) const;
bool segment_is_vector(const int start_index) const;
+ /** See comment and diagram for #calculate_segment_insertion. */
+ struct InsertResult {
+ blender::float3 handle_prev;
+ blender::float3 left_handle;
+ blender::float3 position;
+ blender::float3 right_handle;
+ blender::float3 handle_next;
+ };
+ InsertResult calculate_segment_insertion(const int index,
+ const int next_index,
+ const float parameter);
+
private:
void correct_end_tangents() const final;
void copy_settings(Spline &dst) const final;