Blender V5.3
add_curves_on_mesh.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "BLI_math_vector.hh"
10
11#include "BLI_kdtree_new.hh"
13#include "BLI_math_matrix.hh"
14#include "BLI_math_matrix_c.hh"
16#include "BLI_task.hh"
17
18#include "BKE_attribute_math.hh"
19#include "BKE_mesh.hh"
20#include "BKE_mesh_sample.hh"
21
24
30
31namespace blender::geometry {
32
33using bke::CurvesGeometry;
34
36 /* Curve index of the neighbor. */
37 int index;
38 /* The weights of all neighbors of a new curve add up to 1. */
39 float weight;
40};
41
42static constexpr int max_neighbors = 5;
44
46 const float3 &bary_coord,
47 const Span<float3> corner_normals)
48{
50 bary_coord, corner_tri, corner_normals);
51 return math::normalize(value);
52}
53
55 const float3 &b,
57{
58 const float step = math::rcp(float(dst.size() - 1));
59 for (const int i : dst.index_range()) {
60 dst[i] = bke::attribute_math::mix2(i * step, a, b);
61 }
62}
63
64static void find_curve_neighbors(const Span<float3> root_positions,
65 const KDTreeNew<float3> &old_roots_kdtree,
66 Vector<int> &offset_data,
67 Vector<int> &index_data,
68 Vector<float> &weight_data)
69{
71 const int tot_added_curves = root_positions.size();
72 Array<NeighborCurves> neighbors_per_curve(tot_added_curves);
73 threading::parallel_for(IndexRange(tot_added_curves), 128, [&](const IndexRange range) {
74 for (const int i : range) {
75 const float3 root = root_positions[i];
76 std::array<KDTreeNew<float3>::Nearest, max_neighbors> nearest_n;
77 const int found_neighbors = old_roots_kdtree.find_nearest_n(root, nearest_n);
78 float tot_weight = 0.0f;
79 for (const int neighbor_i : IndexRange(found_neighbors)) {
80 const KDTreeNew<float3>::Nearest &nearest = nearest_n[neighbor_i];
81 const float weight = 1.0f / std::max(std::sqrt(nearest.distance_sq), 0.00001f);
82 tot_weight += weight;
83 neighbors_per_curve[i].append({nearest.index, weight});
84 }
85 /* Normalize weights. */
86 for (NeighborCurve &neighbor : neighbors_per_curve[i]) {
87 neighbor.weight /= tot_weight;
88 }
89 }
90 });
91 offset_data.resize(tot_added_curves + 1);
92 threading::parallel_for(neighbors_per_curve.index_range(), 4096, [&](const IndexRange range) {
93 for (const int i : range) {
94 offset_data[i] = neighbors_per_curve[i].size();
95 }
96 });
98 index_data.resize(offsets.total_size());
99 weight_data.resize(offsets.total_size());
100 threading::parallel_for(offsets.index_range(), 2048, [&](const IndexRange range) {
101 for (const int dst_i : range) {
102 const IndexRange neighbor_range = offsets[dst_i];
103 for (const int i : neighbor_range.index_range()) {
104 index_data[neighbor_range[i]] = neighbors_per_curve[dst_i][i].index;
105 weight_data[neighbor_range[i]] = neighbors_per_curve[dst_i][i].weight;
106 }
107 }
108 });
109}
110
112 const int old_curves_num,
113 const Span<float3> root_positions_cu,
114 const Span<float> new_lengths_cu,
115 const Span<float3> new_normals_su,
116 const float4x4 &surface_to_curves_normal_mat)
117{
119 const int added_curves_num = root_positions_cu.size();
120 const OffsetIndices points_by_curve = curves.points_by_curve();
121 MutableSpan<float3> positions_cu = curves.positions_for_write();
122 threading::parallel_for(IndexRange(added_curves_num), 256, [&](const IndexRange range) {
123 for (const int i : range) {
124 const int curve_i = old_curves_num + i;
125 const IndexRange points = points_by_curve[curve_i];
126 const float3 &root_cu = root_positions_cu[i];
127 const float length = new_lengths_cu[i];
128 const float3 &normal_su = new_normals_su[i];
129 const float3 normal_cu = math::normalize(
130 math::transform_direction(surface_to_curves_normal_mat, normal_su));
131 const float3 tip_cu = root_cu + length * normal_cu;
132
133 calc_straight_curve_positions(root_cu, tip_cu, positions_cu.slice(points));
134 }
135 });
136}
137
139 const Span<float3> root_positions_cu,
140 const OffsetIndices<int> neighbor_offsets,
141 const Span<int> neighbor_indices,
142 const Span<float> neighbor_weights,
143 const int old_curves_num,
144 const Span<float> new_lengths_cu,
145 const Span<float3> new_normals_su,
146 const bke::CurvesSurfaceTransforms &transforms,
147 const Span<int3> corner_tris,
148 const ReverseUVSampler &reverse_uv_sampler,
149 const Span<float3> corner_normals_su)
150{
152 MutableSpan<float3> positions_cu = curves.positions_for_write();
153 const int added_curves_num = root_positions_cu.size();
154
155 const OffsetIndices points_by_curve = curves.points_by_curve();
156 const Span<float2> uv_coords = *curves.surface_uv_coords();
157
158 threading::parallel_for(IndexRange(added_curves_num), 256, [&](const IndexRange range) {
159 for (const int added_curve_i : range) {
160 const IndexRange neighbors = neighbor_offsets[added_curve_i];
161 const int curve_i = old_curves_num + added_curve_i;
162 const IndexRange points = points_by_curve[curve_i];
163
164 const float length_cu = new_lengths_cu[added_curve_i];
165 const float3 &normal_su = new_normals_su[added_curve_i];
166 const float3 normal_cu = math::normalize(
168
169 const float3 &root_cu = root_positions_cu[added_curve_i];
170
171 if (neighbors.is_empty()) {
172 /* If there are no neighbors, just make a straight line. */
173 const float3 tip_cu = root_cu + length_cu * normal_cu;
174 calc_straight_curve_positions(root_cu, tip_cu, positions_cu.slice(points));
175 continue;
176 }
177
178 positions_cu.slice(points).fill(root_cu);
179
180 for (const int neighbor_i : neighbors) {
181 const int neighbor_curve_i = neighbor_indices[neighbor_i];
182 const float neighbor_weight = neighbor_weights[neighbor_i];
183 const float2 neighbor_uv = uv_coords[neighbor_curve_i];
184 const ReverseUVSampler::Result result = reverse_uv_sampler.sample(neighbor_uv);
186 continue;
187 }
188
189 const float3 neighbor_normal_su = compute_surface_point_normal(
190 corner_tris[result.tri_index], result.bary_weights, corner_normals_su);
191 const float3 neighbor_normal_cu = math::normalize(
192 math::transform_direction(transforms.surface_to_curves_normal, neighbor_normal_su));
193
194 /* The rotation matrix used to transform relative coordinates of the neighbor curve
195 * to the new curve. */
196 float normal_rotation_cu[3][3];
197 rotation_between_vecs_to_mat3(normal_rotation_cu, neighbor_normal_cu, normal_cu);
198
199 const IndexRange neighbor_points = points_by_curve[neighbor_curve_i];
200 const float3 &neighbor_root_cu = positions_cu[neighbor_points[0]];
201
202 /* Sample the positions on neighbors and mix them into the final positions of the curve.
203 * Resampling is necessary if the length of the new curve does not match the length of the
204 * neighbors or the number of handle points is different.
205 *
206 * TODO: The lengths can be cached so they aren't recomputed if a curve is a neighbor for
207 * multiple new curves. Also, allocations could be avoided by reusing some arrays. */
208
209 const Span<float3> neighbor_positions_cu = positions_cu.slice(neighbor_points);
210 if (neighbor_positions_cu.size() == 1) {
211 /* Skip interpolating positions from neighbors with only one point. */
212 continue;
213 }
214 Array<float, 32> lengths(length_parameterize::segments_num(neighbor_points.size(), false));
215 length_parameterize::accumulate_lengths<float3>(neighbor_positions_cu, false, lengths);
216 const float neighbor_length_cu = lengths.last();
217
218 Array<float, 32> sample_lengths(points.size());
219 const float length_factor = std::min(1.0f, length_cu / neighbor_length_cu);
220 const float resample_factor = (1.0f / (points.size() - 1.0f)) * length_factor;
221 for (const int i : sample_lengths.index_range()) {
222 sample_lengths[i] = i * resample_factor * neighbor_length_cu;
223 }
224
225 Array<int, 32> indices(points.size());
226 Array<float, 32> factors(points.size());
227 length_parameterize::sample_at_lengths(lengths, sample_lengths, indices, factors);
228
229 for (const int i : IndexRange(points.size())) {
230 const float3 sample_cu = math::interpolate(neighbor_positions_cu[indices[i]],
231 neighbor_positions_cu[indices[i] + 1],
232 factors[i]);
233 const float3 relative_to_root_cu = sample_cu - neighbor_root_cu;
234 float3 rotated_relative_coord = relative_to_root_cu;
235 mul_m3_v3(normal_rotation_cu, rotated_relative_coord);
236 positions_cu[points[i]] += neighbor_weight * rotated_relative_coord;
237 }
238 }
239 }
240 });
241}
242
244 const IndexRange new_points_range,
245 const float radius)
246{
247 const VArray<float> radii = curves.radius();
248 if (const std::optional<float> single = radii.get_if_single()) {
249 if (compare_ff_relative(*single, radius, FLT_EPSILON, 16)) {
250 return;
251 }
252 }
253 curves.radius_for_write().slice(new_points_range).fill(radius);
254 curves.tag_radii_changed();
255}
256
258 const int old_curves_num,
259 const float radius,
260 const Span<float> new_lengths_cu,
261 const OffsetIndices<int> neighbor_offsets,
262 const Span<int> neighbor_indices,
263 const Span<float> neighbor_weights)
264{
265 const int added_curves_num = new_lengths_cu.size();
266 const OffsetIndices points_by_curve = curves.points_by_curve();
267 bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
268 bke::SpanAttributeWriter radius_attr = attributes.lookup_for_write_span<float>("radius");
269 if (!radius_attr) {
270 return;
271 }
272
273 MutableSpan<float3> positions_cu = curves.positions_for_write();
274 MutableSpan<float> radii_cu = radius_attr.span;
275
276 threading::parallel_for(IndexRange(added_curves_num), 256, [&](const IndexRange range) {
277 for (const int i : range) {
278 const IndexRange neighbors = neighbor_offsets[i];
279 const float length_cu = new_lengths_cu[i];
280 const int curve_i = old_curves_num + i;
281 const IndexRange points = points_by_curve[curve_i];
282
283 if (neighbors.is_empty()) {
284 /* If there are no neighbors, just using uniform radius. */
285 radii_cu.slice(points).fill(radius);
286 continue;
287 }
288
289 radii_cu.slice(points).fill(0.0f);
290
291 for (const int neighbor_i : neighbors) {
292 const int neighbor_curve_i = neighbor_indices[neighbor_i];
293 const float neighbor_weight = neighbor_weights[neighbor_i];
294 const IndexRange neighbor_points = points_by_curve[neighbor_curve_i];
295 const Span<float3> neighbor_positions_cu = positions_cu.slice(neighbor_points);
296 const Span<float> neighbor_radii_cu = radius_attr.span.slice(neighbor_points);
297
298 Array<float, 32> lengths(length_parameterize::segments_num(neighbor_points.size(), false));
299 length_parameterize::accumulate_lengths<float3>(neighbor_positions_cu, false, lengths);
300
301 const float neighbor_length_cu = lengths.last();
302
303 Array<float, 32> sample_lengths(points.size());
304 const float length_factor = std::min(1.0f, length_cu / neighbor_length_cu);
305 const float resample_factor = (1.0f / (points.size() - 1.0f)) * length_factor;
306 for (const int i : sample_lengths.index_range()) {
307 sample_lengths[i] = i * resample_factor * neighbor_length_cu;
308 }
309
310 Array<int, 32> indices(points.size());
311 Array<float, 32> factors(points.size());
312 length_parameterize::sample_at_lengths(lengths, sample_lengths, indices, factors);
313
314 for (const int i : IndexRange(points.size())) {
315 const float sample_cu = math::interpolate(
316 neighbor_radii_cu[indices[i]], neighbor_radii_cu[indices[i] + 1], factors[i]);
317
318 radii_cu[points[i]] += neighbor_weight * sample_cu;
319 }
320 }
321 }
322 });
323 radius_attr.finish();
324}
325
327 const AddCurvesOnMeshInputs &inputs)
328{
331
332 const bool use_interpolation = inputs.interpolate_length || inputs.interpolate_point_count ||
333 inputs.interpolate_radius || inputs.interpolate_shape ||
335
336 Vector<float3> root_positions_cu;
337 Vector<float3> bary_coords;
338 Vector<int> tri_indices;
339 Vector<float2> used_uvs;
340
341 /* Find faces that the passed in uvs belong to. */
342 const Span<float3> surface_positions = inputs.surface->vert_positions();
343 const Span<int> surface_corner_verts = inputs.surface->corner_verts();
344 for (const int i : inputs.uvs.index_range()) {
345 const float2 &uv = inputs.uvs[i];
348 outputs.uv_error = true;
349 continue;
350 }
351 const int3 &tri = inputs.surface_corner_tris[result.tri_index];
352 bary_coords.append(result.bary_weights);
353 tri_indices.append(result.tri_index);
354 const float3 root_position_su = bke::attribute_math::mix3<float3>(
355 result.bary_weights,
356 surface_positions[surface_corner_verts[tri[0]]],
357 surface_positions[surface_corner_verts[tri[1]]],
358 surface_positions[surface_corner_verts[tri[2]]]);
359 root_positions_cu.append(
360 math::transform_point(inputs.transforms->surface_to_curves, root_position_su));
361 used_uvs.append(uv);
362 }
363
364 Vector<int> curve_neighbor_offset_data;
365 Vector<int> curve_neighbor_index_data;
366 Vector<float> curve_neighbor_weight_data;
367 if (use_interpolation) {
368 BLI_assert(inputs.old_roots_kdtree != nullptr);
369 find_curve_neighbors(root_positions_cu,
370 *inputs.old_roots_kdtree,
371 curve_neighbor_offset_data,
372 curve_neighbor_index_data,
373 curve_neighbor_weight_data);
374 }
375
376 const int added_curves_num = root_positions_cu.size();
377 const int old_points_num = curves.points_num();
378 const int old_curves_num = curves.curves_num();
379 const int new_curves_num = old_curves_num + added_curves_num;
380
381 /* Grow number of curves first, so that the offsets array can be filled. */
382 curves.resize(old_points_num, new_curves_num);
383 if (new_curves_num == 0) {
384 return outputs;
385 }
386
387 /* Compute new curve offsets. */
388 MutableSpan<int> curve_offsets = curves.offsets_for_write();
389 Array<int> new_point_counts_per_curve(added_curves_num);
390 if (inputs.interpolate_point_count && old_curves_num > 0) {
391 const OffsetIndices<int> old_points_by_curve{curve_offsets.take_front(old_curves_num + 1)};
392 Array<int> sizes(old_curves_num);
393 offset_indices::copy_group_sizes(old_points_by_curve, sizes.index_range(), sizes);
395 OffsetIndices(curve_neighbor_offset_data.as_span()),
396 curve_neighbor_index_data.as_span(),
397 curve_neighbor_weight_data.as_span(),
398 new_point_counts_per_curve.as_mutable_span());
399 }
400 else {
401 new_point_counts_per_curve.fill(inputs.fallback_point_count);
402 }
403 curve_offsets[old_curves_num] = old_points_num;
404 int offset = old_points_num;
405 for (const int i : new_point_counts_per_curve.index_range()) {
406 const int point_count_in_curve = new_point_counts_per_curve[i];
407 curve_offsets[old_curves_num + i + 1] = offset + point_count_in_curve;
408 offset += point_count_in_curve;
409 }
410
411 const int new_points_num = curves.offsets().last();
412 curves.resize(new_points_num, new_curves_num);
413 const OffsetIndices points_by_curve = curves.points_by_curve();
414
415 /* The new elements are added at the end of the arrays. */
416 outputs.new_points_range = curves.points_range().drop_front(old_points_num);
417 outputs.new_curves_range = curves.curves_range().drop_front(old_curves_num);
418
419 /* Initialize attachment information. */
420 MutableSpan<float2> surface_uv_coords = curves.surface_uv_coords_for_write();
421 surface_uv_coords.take_back(added_curves_num).copy_from(used_uvs);
422
423 /* Determine length of new curves. */
424 Span<float3> positions_cu = curves.positions();
425 Array<float> new_lengths_cu(added_curves_num);
426 if (inputs.interpolate_length) {
427 Array<float> lengths(old_curves_num);
428 threading::parallel_for(IndexRange(old_curves_num), 256, [&](const IndexRange range) {
429 for (const int curve_i : range) {
430 const IndexRange points = points_by_curve[curve_i];
431 float length = 0.0f;
432 for (const int segment_i : points.drop_back(1)) {
433 const float3 &p1 = positions_cu[segment_i];
434 const float3 &p2 = positions_cu[segment_i + 1];
435 length += math::distance(p1, p2);
436 }
437 lengths[curve_i] = length;
438 }
439 });
441 OffsetIndices(curve_neighbor_offset_data.as_span()),
442 curve_neighbor_index_data.as_span(),
443 curve_neighbor_weight_data.as_span(),
444 new_lengths_cu.as_mutable_span());
445 }
446 else {
447 new_lengths_cu.fill(inputs.fallback_curve_length);
448 }
449
450 /* Find surface normal at root points. */
451 Array<float3> new_normals_su(added_curves_num);
453 tri_indices,
454 bary_coords,
455 inputs.corner_normals_su,
456 IndexMask(added_curves_num),
457 new_normals_su);
458
459 /* Initialize position attribute. */
460 if (inputs.interpolate_shape) {
462 root_positions_cu,
463 OffsetIndices(curve_neighbor_offset_data.as_span()),
464 curve_neighbor_index_data.as_span(),
465 curve_neighbor_weight_data.as_span(),
466 old_curves_num,
467 new_lengths_cu,
468 new_normals_su,
469 *inputs.transforms,
470 inputs.surface_corner_tris,
471 *inputs.reverse_uv_sampler,
472 inputs.corner_normals_su);
473 }
474 else {
476 old_curves_num,
477 root_positions_cu,
478 new_lengths_cu,
479 new_normals_su,
481 }
482
483 /* Initialize radius attribute */
484 if (inputs.interpolate_radius) {
486 old_curves_num,
488 new_lengths_cu,
489 OffsetIndices(curve_neighbor_offset_data.as_span()),
490 curve_neighbor_index_data.as_span(),
491 curve_neighbor_weight_data.as_span());
492 }
493 else {
496 }
497
498 curves.fill_curve_types(outputs.new_curves_range, CURVE_TYPE_CATMULL_ROM);
499
500 bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
501
502 if (bke::SpanAttributeWriter<int> resolution = attributes.lookup_for_write_span<int>(
503 "resolution"))
504 {
505 if (inputs.interpolate_resolution) {
506 bke::attribute_math::mix_groups(resolution.span,
507 OffsetIndices(curve_neighbor_offset_data.as_span()),
508 curve_neighbor_index_data.as_span(),
509 curve_neighbor_weight_data.as_span(),
510 resolution.span.take_back(added_curves_num));
511 resolution.finish();
512 }
513 else {
514 resolution.span.take_back(added_curves_num).fill(12);
515 }
516 }
517
518 /* Explicitly set all other attributes besides those processed above to default values. */
521 bke::attribute_filter_from_skip_ref({"position", "radius"}),
522 outputs.new_points_range);
524 attributes,
526 bke::attribute_filter_from_skip_ref({"curve_type", "surface_uv_coordinate", "resolution"}),
527 outputs.new_curves_range);
528
529 return outputs;
530}
531
532} // namespace blender::geometry
#define PRF_scope(category)
Span< T > as_span() const
Definition BLI_array.hh:254
MutableSpan< T > as_mutable_span()
Definition BLI_array.hh:259
const T & last(const int64_t n=0) const
Definition BLI_array.hh:307
IndexRange index_range() const
Definition BLI_array.hh:371
void fill(const T &value) const
Definition BLI_array.hh:283
constexpr IndexRange drop_back(int64_t n) const
constexpr int64_t size() const
constexpr bool is_empty() const
constexpr IndexRange()=default
int find_nearest_n(const T &position, MutableSpan< Nearest > r_nearest) const
constexpr int64_t size() const
Definition BLI_span.hh:499
constexpr MutableSpan slice(const int64_t start, const int64_t size) const
Definition BLI_span.hh:579
constexpr MutableSpan take_back(const int64_t n) const
Definition BLI_span.hh:646
constexpr void fill(const T &value) const
Definition BLI_span.hh:523
constexpr IndexRange index_range() const
Definition BLI_span.hh:676
constexpr void copy_from(Span< T > values) const
Definition BLI_span.hh:745
constexpr MutableSpan take_front(const int64_t n) const
Definition BLI_span.hh:635
constexpr int64_t size() const
Definition BLI_span.hh:256
std::optional< T > get_if_single() const
int64_t size() const
void append(const T &value)
void resize(const int64_t new_size)
Span< T > as_span() const
GSpanAttributeWriter lookup_for_write_span(StringRef name)
Result sample(const float2 &query_uv) const
#define FLT_EPSILON
#define bary_coord
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
float length(VecOp< float, D >) RET
T mix3(const float3 &weights, const T &v0, const T &v1, const T &v2)
void mix_groups(GSpan src, OffsetIndices< int > groups, Span< int > all_indices, std::optional< Span< float > > all_weights, GMutableSpan dst)
T mix2(float factor, const T &a, const T &b)
void sample_corner_normals(Span< int3 > corner_tris, Span< int > tri_indices, Span< float3 > bary_coords, Span< float3 > src, const IndexMask &mask, MutableSpan< float3 > dst)
T sample_corner_attribute_with_bary_coords(const float3 &bary_weights, const int3 &corner_tri, const Span< T > corner_attribute)
auto attribute_filter_from_skip_ref(const Span< StringRef > skip)
void fill_attribute_range_default(MutableAttributeAccessor dst_attributes, AttrDomain domain, const AttributeFilter &attribute_filter, IndexRange range)
static void calc_radius_without_interpolation(CurvesGeometry &curves, const IndexRange new_points_range, const float radius)
Vector< NeighborCurve, max_neighbors > NeighborCurves
AddCurvesOnMeshOutputs add_curves_on_mesh(bke::CurvesGeometry &curves, const AddCurvesOnMeshInputs &inputs)
static constexpr int max_neighbors
float3 compute_surface_point_normal(const int3 &tri, const float3 &bary_coord, Span< float3 > corner_normals)
static void calc_radius_with_interpolation(CurvesGeometry &curves, const int old_curves_num, const float radius, const Span< float > new_lengths_cu, const OffsetIndices< int > neighbor_offsets, const Span< int > neighbor_indices, const Span< float > neighbor_weights)
static void calc_position_without_interpolation(CurvesGeometry &curves, const int old_curves_num, const Span< float3 > root_positions_cu, const Span< float > new_lengths_cu, const Span< float3 > new_normals_su, const float4x4 &surface_to_curves_normal_mat)
static void find_curve_neighbors(const Span< float3 > root_positions, const KDTreeNew< float3 > &old_roots_kdtree, Vector< int > &offset_data, Vector< int > &index_data, Vector< float > &weight_data)
static void calc_position_with_interpolation(CurvesGeometry &curves, const Span< float3 > root_positions_cu, const OffsetIndices< int > neighbor_offsets, const Span< int > neighbor_indices, const Span< float > neighbor_weights, const int old_curves_num, const Span< float > new_lengths_cu, const Span< float3 > new_normals_su, const bke::CurvesSurfaceTransforms &transforms, const Span< int3 > corner_tris, const ReverseUVSampler &reverse_uv_sampler, const Span< float3 > corner_normals_su)
static void calc_straight_curve_positions(const float3 &a, const float3 &b, MutableSpan< float3 > dst)
int segments_num(const int points_num, const bool cyclic)
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)
T distance(const T &a, const T &b)
T interpolate(const T &a, const T &b, const FactorT &t)
T rcp(const T &a)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< T, 3 > transform_direction(const MatBase< T, 3, 3 > &mat, const VecBase< T, 3 > &direction)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
void copy_group_sizes(OffsetIndices< int > offsets, const IndexMask &mask, MutableSpan< int > sizes)
OffsetIndices< int > accumulate_counts_to_offsets(MutableSpan< int > counts_to_offsets, int start_offset=0)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
Definition BLI_task.hh:69
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void mul_m3_v3(const float M[3][3], float r[3])
MINLINE int compare_ff_relative(float a, float b, float max_diff, int max_ulps)
MatBase< float, 4, 4 > float4x4
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
@ CURVE_TYPE_CATMULL_ROM
VecBase< float, 3 > float3
void rotation_between_vecs_to_mat3(float m[3][3], const float v1[3], const float v2[3])