21 Array<int> offsets(all_positions.size() + 1, 0);
22 for (
const int curve : all_positions.index_range()) {
24 offsets[curve + 1] = offsets[curve] + curve_positions.
size();
29 curves.offsets_for_write().copy_from(offsets);
35 for (
const int curve : all_positions.index_range()) {
36 positions.
slice(points_by_curve[curve]).
copy_from(all_positions[curve]);
37 cyclic[curve] = is_cyclic.
contains(curve);
38 orders[curve] = order;
41 curves.tag_topology_changed();
70 const Vector<float3> expected_positions = {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}};
82 for (
const int point : expected_positions.
index_range()) {
83 EXPECT_TRUE(positions[point] == expected_positions[point]);
94 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}},
96 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}, {1, -1, 0}}};
109 for (
const int curve : expected_positions.
index_range()) {
110 const Span<float3> expected_curve_positions = expected_positions[curve];
111 const IndexRange points = points_by_curve[curve];
112 for (
const int point : expected_curve_positions.
index_range()) {
113 EXPECT_TRUE(positions[points[point]] == expected_curve_positions[point]);
117 EXPECT_TRUE(positions[10] == expected_positions[0][0]);
118 EXPECT_TRUE(positions[11] == expected_positions[0][1]);
119 EXPECT_TRUE(positions[12] == expected_positions[1][0]);
120 EXPECT_TRUE(positions[13] == expected_positions[2][4]);
127 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}},
129 {{1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {-1, 1, 0}},
130 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}, {1, -1, 0}}};
143 for (
const int curve : expected_positions.
index_range()) {
144 const Span<float3> expected_curve_positions = expected_positions[curve];
145 const IndexRange points = points_by_curve[curve];
146 for (
const int point : expected_curve_positions.
index_range()) {
147 EXPECT_TRUE(positions[points[point]] == expected_curve_positions[point]);
151 EXPECT_TRUE(positions[14] == expected_positions[2][3]);
152 EXPECT_TRUE(positions[15] == expected_positions[2][0]);
158 const Vector<float3> positions = {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}};
167 {{-1, 1, 0}, {1, 1, 0}}, {{-1.5, 0, 0}, {-1, 1, 0}}, {{1, 1, 0}, {1.5, 0, 0}}};
169 GTEST_ASSERT_EQ(new_curves.curves_num(), expected_positions.
size());
170 validate_positions(expected_positions, new_curves.points_by_curve(), new_curves.positions());
177 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}},
179 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}, {1, -1, 0}}};
188 {{-1.5, 0, 0}, {-1, 1, 0}},
189 {{-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}},
192 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}, {1, -1, 0}}};
194 GTEST_ASSERT_EQ(new_curves.
curves_num(), expected_positions.
size());
202 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}},
204 {{1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {-1, 1, 0}},
205 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}, {1, -1, 0}}};
214 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}},
216 {{-1, 1, 0}, {1, 1, 0}},
217 {{1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {-1, 1, 0}},
218 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}, {1, -1, 0}}};
220 GTEST_ASSERT_EQ(new_curves.
curves_num(), expected_positions.
size());
222 Array<bool> expected_cyclic = {
false,
false,
false,
false,
false};
224 for (
const int i : expected_cyclic.
index_range()) {
225 EXPECT_EQ(expected_cyclic[i], cyclic[i]);
233 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}},
235 {{1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {-1, 1, 0}},
236 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}, {1, -1, 0}}};
245 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}},
247 {{1, 1, 0}, {1, -1, 0}},
248 {{1, -1, 0}, {-1, -1, 0}, {-1, 1, 0}, {1, 1, 0}},
249 {{-1.5, 0, 0}, {-1, 1, 0}, {1, 1, 0}, {1.5, 0, 0}, {1, -1, 0}}};
251 GTEST_ASSERT_EQ(new_curves.
curves_num(), expected_positions.
size());
287 GTEST_ASSERT_EQ(new_curves.
curves_num(), expected_positions.
size());
312 {{-1, -1, 0}, {-1, 0, 0}, {-1, 1, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}, {1, -1, 0}},
313 {{1, -1, 0}, {0, -1, 0}, {-1, -1, 0}},
316 GTEST_ASSERT_EQ(new_curves.
curves_num(), expected_positions.
size());
342 {{-1, 1, 0}, {0, 1, 0}},
343 {{1, -1, 0}, {0, -1, 0}},
344 {{0, -1, 0}, {-1, -1, 0}, {-1, 0, 0}, {-1, 1, 0}},
345 {{0, 1, 0}, {1, 1, 0}, {1, 0, 0}, {1, -1, 0}}};
347 GTEST_ASSERT_EQ(new_curves.
curves_num(), expected_positions.
size());