Blender  V3.3
spline_poly.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include "BLI_span.hh"
4 #include "BLI_virtual_array.hh"
5 
6 #include "BKE_spline.hh"
7 
8 using blender::float3;
9 using blender::GVArray;
11 using blender::Span;
12 
14 {
15  /* Poly splines have no settings not covered by the base class. */
16 }
17 
18 void PolySpline::copy_data(Spline &dst) const
19 {
20  PolySpline &poly = static_cast<PolySpline &>(dst);
21  poly.positions_ = positions_;
22  poly.radii_ = radii_;
23  poly.tilts_ = tilts_;
24 }
25 
26 int PolySpline::size() const
27 {
28  const int size = positions_.size();
29  BLI_assert(size == radii_.size());
30  BLI_assert(size == tilts_.size());
31  return size;
32 }
33 
34 void PolySpline::resize(const int size)
35 {
36  positions_.resize(size);
37  radii_.resize(size);
38  tilts_.resize(size);
39  this->mark_cache_invalid();
40  attributes.reallocate(size);
41 }
42 
44 {
45  return positions_;
46 }
48 {
49  return positions_;
50 }
52 {
53  return radii_;
54 }
56 {
57  return radii_;
58 }
60 {
61  return tilts_;
62 }
64 {
65  return tilts_;
66 }
67 
69 {
70 }
71 
73 {
74  tangent_cache_dirty_ = true;
75  normal_cache_dirty_ = true;
76  length_cache_dirty_ = true;
77 }
78 
80 {
81  return this->size();
82 }
83 
85 {
86 }
87 
89 {
90  return this->positions();
91 }
92 
94 {
95  BLI_assert(src.size() == this->size());
96  return src;
97 }
#define BLI_assert(a)
Definition: BLI_assert.h:46
#define UNUSED(x)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
int size() const final
Definition: spline_poly.cc:26
int evaluated_points_num() const final
Definition: spline_poly.cc:79
blender::MutableSpan< float > tilts() final
Definition: spline_poly.cc:59
blender::Span< blender::float3 > evaluated_positions() const final
Definition: spline_poly.cc:88
blender::MutableSpan< float > radii() final
Definition: spline_poly.cc:51
void reverse_impl() override
Definition: spline_poly.cc:68
void mark_cache_invalid() final
Definition: spline_poly.cc:72
void copy_data(Spline &dst) const final
Definition: spline_poly.cc:18
void correct_end_tangents() const final
Definition: spline_poly.cc:84
blender::GVArray interpolate_to_evaluated(const blender::GVArray &src) const final
Definition: spline_poly.cc:93
blender::MutableSpan< blender::float3 > positions() final
Definition: spline_poly.cc:43
void copy_settings(Spline &dst) const final
Definition: spline_poly.cc:13
void resize(int size) final
Definition: spline_poly.cc:34
bool tangent_cache_dirty_
Definition: BKE_spline.hh:65
blender::bke::CustomDataAttributes attributes
Definition: BKE_spline.hh:56
bool normal_cache_dirty_
Definition: BKE_spline.hh:70
bool length_cache_dirty_
Definition: BKE_spline.hh:75
int64_t size() const
Definition: BLI_vector.hh:694
void resize(const int64_t new_size)
Definition: BLI_vector.hh:353
SyclQueue void void * src
vec_base< float, 3 > float3