Blender V5.3
bmo_curve_edge_loops_between_selected.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10#include "BLI_math_vector.hh"
11#include "BLI_math_vector_c.hh"
12
14#include "BLI_math_solvers.hh"
15#include "BLI_set.hh"
16#include "BLI_vector.hh"
17
18#include "bmesh.hh"
19#include "intern/bmesh_operators_private.hh" /* own include */
20
21namespace blender {
22
23constexpr float CURVE_EPSILON = 1e-8f;
24
34
40 float a;
42 float b;
44 float c;
46 float d;
48 float x;
49};
50
56static void calculate_splines_axis(const Span<float> distances,
57 const Span<float> coords,
58 const bool is_closed,
59 Array<SplineCoeffs> &r_coeffs)
60{
61 const int verts_num = coords.size();
62 if (verts_num < 2) {
63 return;
64 }
65 const int segments_num = is_closed ? verts_num : verts_num - 1;
66 Array<float> segment_length(segments_num);
67
68 for (const int i : IndexRange(segments_num)) {
69 segment_length[i] = distances[i + 1] - distances[i];
70 if (!(segment_length[i] > 0.0f)) {
71 segment_length[i] = CURVE_EPSILON;
72 }
73 }
74
75 /* Stores second derivative coefficients. For a natural cubic spline, the boundary
76 * condition defines the first and last points as zero. */
77 Array<float> c_vals(verts_num, 0.0f);
78
79 if (is_closed) {
80 Array<float> lower_diag(verts_num);
81 Array<float> diag(verts_num);
82 Array<float> upper_diag(verts_num);
83 Array<float> rhs(verts_num);
84 for (const int i : IndexRange(verts_num)) {
85 const int i_prev = math::mod_periodic(i - 1, verts_num);
86 const int i_next = math::mod_periodic(i + 1, verts_num);
87 lower_diag[i] = segment_length[i_prev];
88 diag[i] = 2.0f * (segment_length[i_prev] + segment_length[i]);
89 upper_diag[i] = segment_length[i];
90 rhs[i] = 3.0f * (((coords[i_next] - coords[i]) / segment_length[i]) -
91 ((coords[i] - coords[i_prev]) / segment_length[i_prev]));
92 }
94 lower_diag.data(), diag.data(), upper_diag.data(), rhs.data(), c_vals.data(), verts_num);
95 }
96 else {
97 const int interior = verts_num - 2;
98 if (interior > 0) {
99 Array<float> lower_diag(interior);
100 Array<float> diag(interior);
101 Array<float> upper_diag(interior);
102 Array<float> rhs(interior);
103
104 for (const int i_curr : IndexRange(interior)) {
105 const int i_next = i_curr + 1;
106 lower_diag[i_curr] = segment_length[i_curr];
107 diag[i_curr] = 2.0f * (segment_length[i_curr] + segment_length[i_next]);
108 upper_diag[i_curr] = segment_length[i_next];
109 rhs[i_curr] = 3.0f * (((coords[i_next + 1] - coords[i_next]) / segment_length[i_next]) -
110 ((coords[i_next] - coords[i_curr]) / segment_length[i_curr]));
111 }
112 BLI_tridiagonal_solve(lower_diag.data(),
113 diag.data(),
114 upper_diag.data(),
115 rhs.data(),
116 c_vals.data() + 1,
117 interior);
118 }
119 }
120
121 r_coeffs = Array<SplineCoeffs>(segments_num);
122 /* Build polynomial coefficients for each segment. */
123 for (const int i : IndexRange(segments_num)) {
124 const int i_next = is_closed ? math::mod_periodic(i + 1, verts_num) : i + 1;
125 const float coeff_a = coords[i];
126 const float coeff_b = ((coords[i_next] - coords[i]) / segment_length[i]) -
127 (segment_length[i] * (c_vals[i_next] + 2.0f * c_vals[i])) / 3.0f;
128 const float coeff_c = c_vals[i];
129 const float coeff_d = (c_vals[i_next] - c_vals[i]) / (3.0f * segment_length[i]);
130 r_coeffs[i] = {coeff_a, coeff_b, coeff_c, coeff_d, distances[i]};
131 }
132}
133
138static void traverse_edge_loop(BMVert *v_start,
139 BMEdge *e_start,
140 Set<BMEdge *> &visited_edges,
141 Vector<BMVert *> &r_loop,
142 bool &r_circular)
143{
144 BMVert *v_curr = v_start;
145 BMEdge *e_curr = e_start;
146
147 visited_edges.add(e_curr);
148
149 while (true) {
150 BMVert *v_next = BM_edge_other_vert(e_curr, v_curr);
151 r_loop.append(v_next);
152
153 if (v_next == v_start) {
154 r_circular = true;
155 r_loop.pop_last();
156 break;
157 }
158
159 /* Never step between wire & face edges. */
160 const bool is_wire = BM_edge_is_wire(e_curr);
161 int edge_count = 0;
162 BMIter iter;
163 BMEdge *e;
164 BMEdge *e_next = nullptr;
165
166 BM_ITER_ELEM (e, &iter, v_next, BM_EDGES_OF_VERT) {
167 if (BM_edge_is_wire(e) != is_wire) {
168 continue;
169 }
171 edge_count++;
172 }
173 }
174
175 if (is_wire) {
176 /* Stop at the end of a wire chain or where it branches. */
177 if (edge_count != 2) {
178 break;
179 }
180 }
181 else {
182 /* Stop at poles & corners, where the loop has no single continuation. */
183 if (edge_count < 3 || edge_count > 4) {
184 break;
185 }
186 }
187 BM_ITER_ELEM (e, &iter, v_next, BM_EDGES_OF_VERT) {
188 if (BM_edge_is_wire(e) != is_wire) {
189 continue;
190 }
191 if (e == e_curr || BM_elem_flag_test(e, BM_ELEM_HIDDEN) || visited_edges.contains(e)) {
192 continue;
193 }
194
195 if (!BM_edge_share_quad_check(e_curr, e)) {
196 e_next = e;
197 break;
198 }
199 }
200
201 if (!e_next) {
202 break;
203 }
204 e_curr = e_next;
205 v_curr = v_next;
206 visited_edges.add(e_curr);
207 }
208}
209
215{
216 CurveChainData chain;
217 chain.is_closed = false;
218
219 Vector<BMVert *> forward_trace;
220 bool is_forward_circular = false;
221 traverse_edge_loop(e_start->v1, e_start, visited_edges, forward_trace, is_forward_circular);
222
223 if (is_forward_circular) {
224 chain.is_closed = true;
225 chain.verts.append(e_start->v1);
226 chain.verts.extend(forward_trace);
227 }
228 else {
229 Vector<BMVert *> backward_trace;
230 bool is_backward_circular = false;
231 traverse_edge_loop(e_start->v2, e_start, visited_edges, backward_trace, is_backward_circular);
232
233 std::ranges::reverse(backward_trace);
234 chain.verts.extend(backward_trace);
235 chain.verts.extend(forward_trace);
236 }
237
238 return chain;
239}
240
242 Vector<CurveChainData> &r_chains,
243 Set<BMEdge *> &visited_edges)
244{
245 for (BMVert *vert : chain.verts) {
246 BMIter iter;
247 BMEdge *e;
248 BM_ITER_ELEM (e, &iter, vert, BM_EDGES_OF_VERT) {
249 if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) || visited_edges.contains(e)) {
250 continue;
251 }
252 CurveChainData perp_chain = build_curve_chain_from_edge(e, visited_edges);
253 r_chains.append(std::move(perp_chain));
254 }
255 }
256}
257
259{
260 Vector<BMVert *> tag_verts;
261 BMIter iter;
262 BMVert *v;
263 BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
265 tag_verts.append(v);
266 }
267 }
268
269 Set<BMEdge *> visited_edges;
270
271 for (BMVert *v_start : tag_verts) {
272 BMIter v_edge_iter;
273 BMEdge *e_start;
274 BM_ITER_ELEM (e_start, &v_edge_iter, v_start, BM_EDGES_OF_VERT) {
275 if (BM_elem_flag_test(e_start, BM_ELEM_HIDDEN)) {
276 continue;
277 }
278 if (visited_edges.contains(e_start)) {
279 continue;
280 }
281
282 CurveChainData chain = build_curve_chain_from_edge(e_start, visited_edges);
283
284 if (chain.verts.size() < 3) {
285 continue;
286 }
287
288 int tag_count = 0;
289 for (BMVert *v_chain : chain.verts) {
290 if (BM_elem_flag_test(v_chain, BM_ELEM_TAG)) {
291 tag_count++;
292 }
293 }
294
295 /* If a whole edge loop is tagged, all edge loops perpendicular to it are operated on,
296 * with the tagged edge loop being used as control points. */
297 if (tag_count == chain.verts.size()) {
298 get_perpendicular_chains(chain, r_chains, visited_edges);
299 }
300 else if (tag_count >= 1) {
301 r_chains.append(std::move(chain));
302 }
303 }
304 }
305}
306
312 int &r_longest_gap,
313 int &r_best_gap_start)
314{
315 const int verts_num = verts.size();
316 Vector<int> selected_indices;
317
318 for (const int i : verts.index_range()) {
319 if (BM_elem_flag_test(verts[i], BM_ELEM_TAG)) {
320 selected_indices.append(i);
321 }
322 }
323
324 if (selected_indices.is_empty()) {
325 r_longest_gap = verts_num;
326 r_best_gap_start = 0;
327 return;
328 }
329
330 int longest_gap = -1;
331 int best_gap_start = -1;
332
333 for (const int i : selected_indices.index_range()) {
334 int i_curr = selected_indices[i];
335 int i_next = selected_indices[math::mod_periodic(i + 1, int(selected_indices.size()))];
336 int gap_size = math::mod_periodic(i_next - i_curr - 1, verts_num);
337
338 if (gap_size > longest_gap) {
339 longest_gap = gap_size;
340 best_gap_start = math::mod_periodic(i_curr + 1, verts_num);
341 }
342 }
343
344 r_longest_gap = longest_gap;
345 r_best_gap_start = best_gap_start;
346}
347
349{
350 for (CurveChainData &chain : chains) {
351 if (chain.is_closed) {
352 int longest_gap, best_gap_start;
353 find_longest_unselected_gap(chain.verts, longest_gap, best_gap_start);
354
355 if (longest_gap > 0) {
356 int new_start_index = math::mod_periodic(best_gap_start + longest_gap,
357 int(chain.verts.size()));
358 /* Pushes the unselected gap to the end of the vector so it's easy to trim it off. */
359 std::rotate(chain.verts.begin(), chain.verts.begin() + new_start_index, chain.verts.end());
360 }
361 chain.is_closed = false;
362 }
363
364 int first_selected = -1;
365 int last_selected = -1;
366 for (const int i : chain.verts.index_range()) {
367 if (BM_elem_flag_test(chain.verts[i], BM_ELEM_TAG)) {
368 if (first_selected == -1) {
369 first_selected = i;
370 }
371 last_selected = i;
372 }
373 }
374
375 if (first_selected > 0 || last_selected < chain.verts.size() - 1) {
376 Vector<BMVert *> trimmed;
377 for (int i = first_selected; i <= last_selected; i++) {
378 trimmed.append(chain.verts[i]);
379 }
380 chain.verts = std::move(trimmed);
381 }
382 BLI_assert(!chain.verts.is_empty());
383 }
384}
385
387 const Span<int> knot_indices,
388 const Span<int> point_indices,
389 const bool is_closed,
390 const bool regular,
391 Array<float> &r_knot_distances,
392 Array<float> &r_point_distances)
393{
394 const int verts_num = verts.size();
395
396 Array<float3> positions(verts_num);
397 for (const int i : IndexRange(verts_num)) {
398 positions[i] = float3(verts[i]->co);
399 }
400 const int cumulative_array_size = verts_num + (is_closed ? 1 : 0);
401 Array<float> cumulative(cumulative_array_size);
402 cumulative[0] = 0.0f;
404 positions, is_closed, cumulative.as_mutable_span().drop_front(1));
405
406 r_knot_distances = Array<float>(knot_indices.size() + (is_closed ? 1 : 0));
407 r_point_distances = Array<float>(point_indices.size());
408
409 int knot_index = 0;
410 int point_index = 0;
411 for (const int i : IndexRange(verts_num)) {
412 if (knot_index < knot_indices.size() && knot_indices[knot_index] == i) {
413 r_knot_distances[knot_index] = cumulative[i];
414 knot_index++;
415 }
416 else {
417 r_point_distances[point_index] = cumulative[i];
418 point_index++;
419 }
420 }
421
422 if (is_closed) {
423 const float total_length = cumulative.last();
424 r_knot_distances[knot_index++] = total_length;
425 }
426
427 if (regular) {
428 const float total = cumulative.last();
429 if (total > CURVE_EPSILON) {
430 const float spacing = total / float(is_closed ? verts_num : verts_num - 1);
431 for (const int i : point_indices.index_range()) {
432 const int v_index = point_indices[i];
433 r_point_distances[i] = float(v_index) * spacing;
434 }
435 for (const int ki : knot_indices.index_range()) {
436 r_knot_distances[ki] = float(knot_indices[ki]) * spacing;
437 }
438 if (is_closed) {
439 r_knot_distances[knot_indices.size()] = total;
440 }
441 }
442 }
443}
444
445static void calculate_curve_splines(const Span<float3> knot_positions,
446 const Span<float> knot_distances,
447 const bool is_closed,
448 std::array<Array<SplineCoeffs>, 3> &r_coeffs)
449{
450 const int knots_num = knot_positions.size();
451 Array<float> coords_x(knots_num);
452 Array<float> coords_y(knots_num);
453 Array<float> coords_z(knots_num);
454
455 for (const int i : IndexRange(knots_num)) {
456 coords_x[i] = knot_positions[i].x;
457 coords_y[i] = knot_positions[i].y;
458 coords_z[i] = knot_positions[i].z;
459 }
460
461 calculate_splines_axis(knot_distances, coords_x, is_closed, r_coeffs[0]);
462 calculate_splines_axis(knot_distances, coords_y, is_closed, r_coeffs[1]);
463 calculate_splines_axis(knot_distances, coords_z, is_closed, r_coeffs[2]);
464}
465
466static void execute_curve_chain(const Span<BMVert *> input_chain,
467 bool is_closed,
468 const CurveInterpolation interpolation,
469 const CurveClampElevation clamp_elevation,
470 const bool regular,
471 const float factor,
472 const bool lock_x,
473 const bool lock_y,
474 const bool lock_z)
475{
476 int verts_num = input_chain.size();
477 int new_start_index = 0;
478
479 if (is_closed) {
480 int longest_gap, best_gap_start;
481 find_longest_unselected_gap(input_chain, longest_gap, best_gap_start);
482
483 int offset = verts_num / 4;
484
485 /* For a closed circle, if more than 50 percent of the vertices in the circle are unselected,
486 * in order to prevent a total collapse from happening, the tool's influence is restricted to
487 * 25 percent of the total vertices on either side of the selection. */
488 if (longest_gap > 2 * offset) {
489 is_closed = false;
490
491 int trim_start = math::mod_periodic(best_gap_start + longest_gap - offset, verts_num);
492 int trim_end = math::mod_periodic(best_gap_start - 1 + offset, verts_num);
493
494 new_start_index = trim_start;
495 verts_num = math::mod_periodic(trim_end - trim_start, verts_num) + 1;
496 }
497 else {
498 for (const int i : input_chain.index_range()) {
499 if (BM_elem_flag_test(input_chain[i], BM_ELEM_TAG)) {
500 new_start_index = i;
501 break;
502 }
503 }
504 }
505 }
506
507 Array<BMVert *> verts(verts_num);
508 for (const int i : IndexRange(verts_num)) {
509 verts[i] = input_chain[math::mod_periodic(i + new_start_index, int(input_chain.size()))];
510 }
511
512 Vector<int> knot_indices;
513 for (const int i : IndexRange(verts_num)) {
514 if (BM_elem_flag_test(verts[i], BM_ELEM_TAG)) {
515 knot_indices.append(i);
516 }
517 }
518
519 if (!is_closed) {
520 if (knot_indices.is_empty() || knot_indices.first() != 0) {
521 knot_indices.insert(0, 0);
522 }
523 if (knot_indices.last() != verts_num - 1) {
524 knot_indices.append(verts_num - 1);
525 }
526 }
527
528 Array<float3> knot_positions(knot_indices.size());
529 for (const int ki : knot_indices.index_range()) {
530 knot_positions[ki] = float3(verts[knot_indices[ki]]->co);
531 }
532
533 Array<float> knot_distances;
534 Array<float> point_distances;
535 Array<int> point_indices(verts_num - knot_indices.size());
536
537 std::set_difference(IndexRange(verts_num).begin(),
538 IndexRange(verts_num).end(),
539 knot_indices.data(),
540 knot_indices.data() + knot_indices.size(),
541 point_indices.data());
542
544 verts, knot_indices, point_indices, is_closed, regular, knot_distances, point_distances);
545
546 if (point_indices.is_empty()) {
547 return;
548 }
549
550 const int points_num = point_indices.size();
551 Array<float3> new_positions(points_num);
552 Array<int> segment_indices(points_num);
553 Array<float> factors(points_num);
554
556 knot_distances.as_span().drop_front(1), point_distances, segment_indices, factors);
557
558 if (interpolation == CURVE_INTERP_CUBIC) {
559 std::array<Array<SplineCoeffs>, 3> axis_coeffs;
560 calculate_curve_splines(knot_positions, knot_distances, is_closed, axis_coeffs);
561
562 for (const int i : IndexRange(points_num)) {
563 const int seg = segment_indices[i];
564 const float dt = point_distances[i] - axis_coeffs[0][seg].x;
565
566 const SplineCoeffs &cx = axis_coeffs[0][seg];
567 const SplineCoeffs &cy = axis_coeffs[1][seg];
568 const SplineCoeffs &cz = axis_coeffs[2][seg];
569
570 new_positions[i] = float3(cx.a + dt * (cx.b + dt * (cx.c + dt * cx.d)),
571 cy.a + dt * (cy.b + dt * (cy.c + dt * cy.d)),
572 cz.a + dt * (cz.b + dt * (cz.c + dt * cz.d)));
573 }
574 }
575 else if (interpolation == CURVE_INTERP_LINEAR) {
577 knot_positions, segment_indices, factors, new_positions);
578 }
579
580 for (const int i : point_indices.index_range()) {
581 const int v_index = point_indices[i];
582 BMVert *vert = verts[v_index];
583 float3 new_pos = new_positions[i];
584
585 const float3 old_pos(vert->co);
586 const float3 delta = new_pos - old_pos;
587
588 /* Wire vertices have no face normal to clamp against. */
589 if ((clamp_elevation != CURVE_CLAMP_ELEVATION_NONE) && !BM_vert_is_wire(vert)) {
591 const float3 normal(vert->no);
592 const float dot_val = math::dot(delta, normal);
593
594 if (clamp_elevation == CURVE_CLAMP_ELEVATION_RAISE) {
595 if (dot_val < -CURVE_EPSILON) {
596 continue;
597 }
598 }
599 else if (clamp_elevation == CURVE_CLAMP_ELEVATION_LOWER) {
600 if (dot_val > CURVE_EPSILON) {
601 continue;
602 }
603 }
604 }
605 }
606
607 if (lock_x) {
608 new_pos.x = old_pos.x;
609 }
610 if (lock_y) {
611 new_pos.y = old_pos.y;
612 }
613 if (lock_z) {
614 new_pos.z = old_pos.z;
615 }
616
617 const float3 final_pos = math::interpolate(old_pos, new_pos, factor);
618 copy_v3_v3(vert->co, final_pos);
619 }
620}
621
623{
624 const float factor = BMO_slot_float_get(op->slots_in, "factor");
625 const CurveClampElevation clamp_elevation = static_cast<CurveClampElevation>(
626 BMO_slot_int_get(op->slots_in, "clamp_elevation"));
627 const bool extend_loop = BMO_slot_bool_get(op->slots_in, "extend_loop");
628 const bool regular = BMO_slot_bool_get(op->slots_in, "regular");
629 const bool lock_x = BMO_slot_bool_get(op->slots_in, "lock_x");
630 const bool lock_y = BMO_slot_bool_get(op->slots_in, "lock_y");
631 const bool lock_z = BMO_slot_bool_get(op->slots_in, "lock_z");
632 const CurveInterpolation interpolation = static_cast<CurveInterpolation>(
633 BMO_slot_int_get(op->slots_in, "interpolation"));
634
636
639
640 if (!extend_loop) {
642 }
643
644 for (const CurveChainData &chain : chains) {
645 execute_curve_chain(chain.verts,
646 chain.is_closed,
647 interpolation,
648 clamp_elevation,
649 regular,
650 factor,
651 lock_x,
652 lock_y,
653 lock_z);
654 }
655}
656
657} // namespace blender
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
int64_t size() const
Definition BLI_array.hh:267
Span< T > as_span() const
Definition BLI_array.hh:254
MutableSpan< T > as_mutable_span()
Definition BLI_array.hh:259
Array(Allocator allocator={}) noexcept
Definition BLI_array.hh:78
const T * data() const
Definition BLI_array.hh:323
IndexRange index_range() const
Definition BLI_array.hh:371
bool is_empty() const
Definition BLI_array.hh:275
constexpr IndexRange()=default
bool contains(const Key &key) const
Definition BLI_set.hh:310
bool add(const Key &key)
Definition BLI_set.hh:248
constexpr int64_t size() const
Definition BLI_span.hh:256
constexpr IndexRange index_range() const
Definition BLI_span.hh:405
int64_t size() const
void append(const T &value)
void insert(const int64_t insert_index, const T &value)
const T & last(const int64_t n=0) const
bool is_empty() const
IndexRange index_range() const
const T & first() const
void accumulate_lengths(const Span< T > values, const bool cyclic, MutableSpan< float > lengths)
void sample_at_lengths(Span< float > accumulated_segment_lengths, Span< float > sample_lengths, MutableSpan< int > r_segment_indices, MutableSpan< float > r_factors)
void interpolate(const Span< T > src, const Span< int > indices, const Span< float > factors, MutableSpan< T > dst)
T length_squared(const VecBase< T, Size > &a)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
T interpolate(const T &a, const T &b, const FactorT &t)
T square(const T &a)
T mod_periodic(const T &a, const T &b)
BMesh Iterators.
bool BLI_tridiagonal_solve_cyclic(const float *a, const float *b, const float *c, const float *d, float *r_x, int count)
Solve a possibly cyclic tridiagonal system using the Sherman-Morrison formula.
static void calc_curve_input_chains_from_bm(BMesh *bm, Vector< CurveChainData > &r_chains)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static void get_perpendicular_chains(const CurveChainData &chain, Vector< CurveChainData > &r_chains, Set< BMEdge * > &visited_edges)
static void traverse_edge_loop(BMVert *v_start, BMEdge *e_start, Set< BMEdge * > &visited_edges, Vector< BMVert * > &r_loop, bool &r_circular)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, char hflag, bool do_flush)
BMO_FLAG_BUFFER.
static void execute_curve_chain(const Span< BMVert * > input_chain, bool is_closed, const CurveInterpolation interpolation, const CurveClampElevation clamp_elevation, const bool regular, const float factor, const bool lock_x, const bool lock_y, const bool lock_z)
bool BM_vert_is_wire(const BMVert *v)
bool BLI_tridiagonal_solve(const float *a, const float *b, const float *c, const float *d, float *r_x, int count)
Solve a tridiagonal system of equations:
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
ATTR_WARN_UNUSED_RESULT const BMVert * v
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static CurveChainData build_curve_chain_from_edge(BMEdge *e_start, Set< BMEdge * > &visited_edges)
@ CURVE_CLAMP_ELEVATION_RAISE
@ CURVE_CLAMP_ELEVATION_LOWER
@ CURVE_CLAMP_ELEVATION_NONE
static void trim_chains_to_boundaries(Vector< CurveChainData > &chains)
static void calculate_splines_axis(const Span< float > distances, const Span< float > coords, const bool is_closed, Array< SplineCoeffs > &r_coeffs)
bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
static void find_longest_unselected_gap(const Span< BMVert * > verts, int &r_longest_gap, int &r_best_gap_start)
bool BM_edge_share_quad_check(BMEdge *e1, BMEdge *e2)
iter begin(iter)
static void calculate_curve_splines(const Span< float3 > knot_positions, const Span< float > knot_distances, const bool is_closed, std::array< Array< SplineCoeffs >, 3 > &r_coeffs)
VecBase< float, 3 > float3
void bmo_curve_edge_loops_between_selected_exec(BMesh *bm, BMOperator *op)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static void calculate_curve_distances(const Span< BMVert * > verts, const Span< int > knot_indices, const Span< int > point_indices, const bool is_closed, const bool regular, Array< float > &r_knot_distances, Array< float > &r_point_distances)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]