Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/tests/scene/test_curve.h
10277 views
1
/**************************************************************************/
2
/* test_curve.h */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
/**************************************************************************/
30
31
#pragma once
32
33
#include "core/math/math_funcs.h"
34
#include "scene/resources/curve.h"
35
36
#include "tests/test_macros.h"
37
38
namespace TestCurve {
39
40
TEST_CASE("[Curve] Default curve") {
41
const Ref<Curve> curve = memnew(Curve);
42
43
CHECK_MESSAGE(
44
curve->get_point_count() == 0,
45
"Default curve should contain the expected number of points.");
46
CHECK_MESSAGE(
47
Math::is_zero_approx(curve->sample(0)),
48
"Default curve should return the expected value at offset 0.0.");
49
CHECK_MESSAGE(
50
Math::is_zero_approx(curve->sample(0.5)),
51
"Default curve should return the expected value at offset 0.5.");
52
CHECK_MESSAGE(
53
Math::is_zero_approx(curve->sample(1)),
54
"Default curve should return the expected value at offset 1.0.");
55
}
56
57
TEST_CASE("[Curve] Custom unit curve with free tangents") {
58
Ref<Curve> curve = memnew(Curve);
59
// "Sawtooth" curve with an open ending towards the 1.0 offset.
60
curve->add_point(Vector2(0, 0));
61
curve->add_point(Vector2(0.25, 1));
62
curve->add_point(Vector2(0.5, 0));
63
curve->add_point(Vector2(0.75, 1));
64
curve->set_bake_resolution(11);
65
66
CHECK_MESSAGE(
67
Math::is_zero_approx(curve->get_point_left_tangent(0)),
68
"get_point_left_tangent() should return the expected value for point index 0.");
69
CHECK_MESSAGE(
70
Math::is_zero_approx(curve->get_point_right_tangent(0)),
71
"get_point_right_tangent() should return the expected value for point index 0.");
72
CHECK_MESSAGE(
73
curve->get_point_left_mode(0) == Curve::TangentMode::TANGENT_FREE,
74
"get_point_left_mode() should return the expected value for point index 0.");
75
CHECK_MESSAGE(
76
curve->get_point_right_mode(0) == Curve::TangentMode::TANGENT_FREE,
77
"get_point_right_mode() should return the expected value for point index 0.");
78
79
CHECK_MESSAGE(
80
curve->get_point_count() == 4,
81
"Custom free curve should contain the expected number of points.");
82
83
CHECK_MESSAGE(
84
Math::is_zero_approx(curve->sample(-0.1)),
85
"Custom free curve should return the expected value at offset -0.1.");
86
CHECK_MESSAGE(
87
curve->sample(0.1) == doctest::Approx((real_t)0.352),
88
"Custom free curve should return the expected value at offset 0.1.");
89
CHECK_MESSAGE(
90
curve->sample(0.4) == doctest::Approx((real_t)0.352),
91
"Custom free curve should return the expected value at offset 0.4.");
92
CHECK_MESSAGE(
93
curve->sample(0.7) == doctest::Approx((real_t)0.896),
94
"Custom free curve should return the expected value at offset 0.7.");
95
CHECK_MESSAGE(
96
curve->sample(1) == doctest::Approx(1),
97
"Custom free curve should return the expected value at offset 1.");
98
CHECK_MESSAGE(
99
curve->sample(2) == doctest::Approx(1),
100
"Custom free curve should return the expected value at offset 2.");
101
102
CHECK_MESSAGE(
103
Math::is_zero_approx(curve->sample_baked(-0.1)),
104
"Custom free curve should return the expected baked value at offset -0.1.");
105
CHECK_MESSAGE(
106
curve->sample_baked(0.1) == doctest::Approx((real_t)0.352),
107
"Custom free curve should return the expected baked value at offset 0.1.");
108
CHECK_MESSAGE(
109
curve->sample_baked(0.4) == doctest::Approx((real_t)0.352),
110
"Custom free curve should return the expected baked value at offset 0.4.");
111
CHECK_MESSAGE(
112
curve->sample_baked(0.7) == doctest::Approx((real_t)0.896),
113
"Custom free curve should return the expected baked value at offset 0.7.");
114
CHECK_MESSAGE(
115
curve->sample_baked(1) == doctest::Approx(1),
116
"Custom free curve should return the expected baked value at offset 1.");
117
CHECK_MESSAGE(
118
curve->sample_baked(2) == doctest::Approx(1),
119
"Custom free curve should return the expected baked value at offset 2.");
120
121
curve->remove_point(1);
122
CHECK_MESSAGE(
123
curve->sample(0.1) == doctest::Approx(0),
124
"Custom free curve should return the expected value at offset 0.1 after removing point at index 1.");
125
CHECK_MESSAGE(
126
curve->sample_baked(0.1) == doctest::Approx(0),
127
"Custom free curve should return the expected baked value at offset 0.1 after removing point at index 1.");
128
129
curve->clear_points();
130
CHECK_MESSAGE(
131
curve->sample(0.6) == doctest::Approx(0),
132
"Custom free curve should return the expected value at offset 0.6 after clearing all points.");
133
CHECK_MESSAGE(
134
curve->sample_baked(0.6) == doctest::Approx(0),
135
"Custom free curve should return the expected baked value at offset 0.6 after clearing all points.");
136
}
137
138
TEST_CASE("[Curve] Custom non-unit curve with free tangents") {
139
Ref<Curve> curve = memnew(Curve);
140
curve->set_min_domain(-100.0);
141
curve->set_max_domain(100.0);
142
// "Sawtooth" curve with an open ending towards the 100 offset.
143
curve->add_point(Vector2(-100, 0));
144
curve->add_point(Vector2(-50, 1));
145
curve->add_point(Vector2(0, 0));
146
curve->add_point(Vector2(50, 1));
147
curve->set_bake_resolution(11);
148
149
CHECK_MESSAGE(
150
Math::is_zero_approx(curve->get_point_left_tangent(0)),
151
"get_point_left_tangent() should return the expected value for point index 0.");
152
CHECK_MESSAGE(
153
Math::is_zero_approx(curve->get_point_right_tangent(0)),
154
"get_point_right_tangent() should return the expected value for point index 0.");
155
CHECK_MESSAGE(
156
curve->get_point_left_mode(0) == Curve::TangentMode::TANGENT_FREE,
157
"get_point_left_mode() should return the expected value for point index 0.");
158
CHECK_MESSAGE(
159
curve->get_point_right_mode(0) == Curve::TangentMode::TANGENT_FREE,
160
"get_point_right_mode() should return the expected value for point index 0.");
161
162
CHECK_MESSAGE(
163
curve->get_point_count() == 4,
164
"Custom free curve should contain the expected number of points.");
165
166
CHECK_MESSAGE(
167
Math::is_zero_approx(curve->sample(-200)),
168
"Custom free curve should return the expected value at offset -200.");
169
CHECK_MESSAGE(
170
curve->sample(0.1 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.352),
171
"Custom free curve should return the expected value at offset equivalent to a unit curve's 0.1.");
172
CHECK_MESSAGE(
173
curve->sample(0.4 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.352),
174
"Custom free curve should return the expected value at offset equivalent to a unit curve's 0.4.");
175
CHECK_MESSAGE(
176
curve->sample(0.7 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.896),
177
"Custom free curve should return the expected value at offset equivalent to a unit curve's 0.7.");
178
CHECK_MESSAGE(
179
curve->sample(1 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(1),
180
"Custom free curve should return the expected value at offset equivalent to a unit curve's 1.");
181
CHECK_MESSAGE(
182
curve->sample(2 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(1),
183
"Custom free curve should return the expected value at offset equivalent to a unit curve's 2.");
184
185
CHECK_MESSAGE(
186
Math::is_zero_approx(curve->sample_baked(-200)),
187
"Custom free curve should return the expected baked value at offset equivalent to a unit curve's -0.1.");
188
CHECK_MESSAGE(
189
curve->sample_baked(0.1 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.352),
190
"Custom free curve should return the expected baked value at offset equivalent to a unit curve's 0.1.");
191
CHECK_MESSAGE(
192
curve->sample_baked(0.4 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.352),
193
"Custom free curve should return the expected baked value at offset equivalent to a unit curve's 0.4.");
194
CHECK_MESSAGE(
195
curve->sample_baked(0.7 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.896),
196
"Custom free curve should return the expected baked value at offset equivalent to a unit curve's 0.7.");
197
CHECK_MESSAGE(
198
curve->sample_baked(1 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(1),
199
"Custom free curve should return the expected baked value at offset equivalent to a unit curve's 1.");
200
CHECK_MESSAGE(
201
curve->sample_baked(2 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(1),
202
"Custom free curve should return the expected baked value at offset equivalent to a unit curve's 2.");
203
204
curve->remove_point(1);
205
CHECK_MESSAGE(
206
curve->sample(0.1 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(0),
207
"Custom free curve should return the expected value at offset equivalent to a unit curve's 0.1 after removing point at index 1.");
208
CHECK_MESSAGE(
209
curve->sample_baked(0.1 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(0),
210
"Custom free curve should return the expected baked value at offset equivalent to a unit curve's 0.1 after removing point at index 1.");
211
212
curve->clear_points();
213
CHECK_MESSAGE(
214
curve->sample(0.6 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(0),
215
"Custom free curve should return the expected value at offset 0.6 after clearing all points.");
216
CHECK_MESSAGE(
217
curve->sample_baked(0.6 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(0),
218
"Custom free curve should return the expected baked value at offset 0.6 after clearing all points.");
219
}
220
221
TEST_CASE("[Curve] Custom unit curve with linear tangents") {
222
Ref<Curve> curve = memnew(Curve);
223
// "Sawtooth" curve with an open ending towards the 1.0 offset.
224
curve->add_point(Vector2(0, 0), 0, 0, Curve::TangentMode::TANGENT_LINEAR, Curve::TangentMode::TANGENT_LINEAR);
225
curve->add_point(Vector2(0.25, 1), 0, 0, Curve::TangentMode::TANGENT_LINEAR, Curve::TangentMode::TANGENT_LINEAR);
226
curve->add_point(Vector2(0.5, 0), 0, 0, Curve::TangentMode::TANGENT_LINEAR, Curve::TangentMode::TANGENT_LINEAR);
227
curve->add_point(Vector2(0.75, 1), 0, 0, Curve::TangentMode::TANGENT_LINEAR, Curve::TangentMode::TANGENT_LINEAR);
228
229
CHECK_MESSAGE(
230
curve->get_point_left_tangent(3) == doctest::Approx(4),
231
"get_point_left_tangent() should return the expected value for point index 3.");
232
CHECK_MESSAGE(
233
Math::is_zero_approx(curve->get_point_right_tangent(3)),
234
"get_point_right_tangent() should return the expected value for point index 3.");
235
CHECK_MESSAGE(
236
curve->get_point_left_mode(3) == Curve::TangentMode::TANGENT_LINEAR,
237
"get_point_left_mode() should return the expected value for point index 3.");
238
CHECK_MESSAGE(
239
curve->get_point_right_mode(3) == Curve::TangentMode::TANGENT_LINEAR,
240
"get_point_right_mode() should return the expected value for point index 3.");
241
242
ERR_PRINT_OFF;
243
CHECK_MESSAGE(
244
Math::is_zero_approx(curve->get_point_right_tangent(300)),
245
"get_point_right_tangent() should return the expected value for invalid point index 300.");
246
CHECK_MESSAGE(
247
curve->get_point_left_mode(-12345) == Curve::TangentMode::TANGENT_FREE,
248
"get_point_left_mode() should return the expected value for invalid point index -12345.");
249
ERR_PRINT_ON;
250
251
CHECK_MESSAGE(
252
curve->get_point_count() == 4,
253
"Custom linear curve should contain the expected number of points.");
254
255
CHECK_MESSAGE(
256
Math::is_zero_approx(curve->sample(-0.1)),
257
"Custom linear curve should return the expected value at offset -0.1.");
258
CHECK_MESSAGE(
259
curve->sample(0.1) == doctest::Approx((real_t)0.4),
260
"Custom linear curve should return the expected value at offset 0.1.");
261
CHECK_MESSAGE(
262
curve->sample(0.4) == doctest::Approx((real_t)0.4),
263
"Custom linear curve should return the expected value at offset 0.4.");
264
CHECK_MESSAGE(
265
curve->sample(0.7) == doctest::Approx((real_t)0.8),
266
"Custom linear curve should return the expected value at offset 0.7.");
267
CHECK_MESSAGE(
268
curve->sample(1) == doctest::Approx(1),
269
"Custom linear curve should return the expected value at offset 1.0.");
270
CHECK_MESSAGE(
271
curve->sample(2) == doctest::Approx(1),
272
"Custom linear curve should return the expected value at offset 2.0.");
273
274
CHECK_MESSAGE(
275
Math::is_zero_approx(curve->sample_baked(-0.1)),
276
"Custom linear curve should return the expected baked value at offset -0.1.");
277
CHECK_MESSAGE(
278
curve->sample_baked(0.1) == doctest::Approx((real_t)0.4),
279
"Custom linear curve should return the expected baked value at offset 0.1.");
280
CHECK_MESSAGE(
281
curve->sample_baked(0.4) == doctest::Approx((real_t)0.4),
282
"Custom linear curve should return the expected baked value at offset 0.4.");
283
CHECK_MESSAGE(
284
curve->sample_baked(0.7) == doctest::Approx((real_t)0.8),
285
"Custom linear curve should return the expected baked value at offset 0.7.");
286
CHECK_MESSAGE(
287
curve->sample_baked(1) == doctest::Approx(1),
288
"Custom linear curve should return the expected baked value at offset 1.0.");
289
CHECK_MESSAGE(
290
curve->sample_baked(2) == doctest::Approx(1),
291
"Custom linear curve should return the expected baked value at offset 2.0.");
292
293
ERR_PRINT_OFF;
294
curve->remove_point(10);
295
ERR_PRINT_ON;
296
CHECK_MESSAGE(
297
curve->sample(0.7) == doctest::Approx((real_t)0.8),
298
"Custom free curve should return the expected value at offset 0.7 after removing point at invalid index 10.");
299
CHECK_MESSAGE(
300
curve->sample_baked(0.7) == doctest::Approx((real_t)0.8),
301
"Custom free curve should return the expected baked value at offset 0.7 after removing point at invalid index 10.");
302
}
303
304
TEST_CASE("[Curve] Custom non-unit curve with linear tangents") {
305
Ref<Curve> curve = memnew(Curve);
306
curve->set_min_domain(-100.0);
307
curve->set_max_domain(100.0);
308
// "Sawtooth" curve with an open ending towards the 100 offset.
309
curve->add_point(Vector2(-100, 0), 0, 0, Curve::TangentMode::TANGENT_LINEAR, Curve::TangentMode::TANGENT_LINEAR);
310
curve->add_point(Vector2(-50, 1), 0, 0, Curve::TangentMode::TANGENT_LINEAR, Curve::TangentMode::TANGENT_LINEAR);
311
curve->add_point(Vector2(0, 0), 0, 0, Curve::TangentMode::TANGENT_LINEAR, Curve::TangentMode::TANGENT_LINEAR);
312
curve->add_point(Vector2(50, 1), 0, 0, Curve::TangentMode::TANGENT_LINEAR, Curve::TangentMode::TANGENT_LINEAR);
313
314
CHECK_MESSAGE(
315
curve->get_point_left_tangent(3) == doctest::Approx(1.f / 50),
316
"get_point_left_tangent() should return the expected value for point index 3.");
317
CHECK_MESSAGE(
318
Math::is_zero_approx(curve->get_point_right_tangent(3)),
319
"get_point_right_tangent() should return the expected value for point index 3.");
320
CHECK_MESSAGE(
321
curve->get_point_left_mode(3) == Curve::TangentMode::TANGENT_LINEAR,
322
"get_point_left_mode() should return the expected value for point index 3.");
323
CHECK_MESSAGE(
324
curve->get_point_right_mode(3) == Curve::TangentMode::TANGENT_LINEAR,
325
"get_point_right_mode() should return the expected value for point index 3.");
326
327
ERR_PRINT_OFF;
328
CHECK_MESSAGE(
329
Math::is_zero_approx(curve->get_point_right_tangent(300)),
330
"get_point_right_tangent() should return the expected value for invalid point index 300.");
331
CHECK_MESSAGE(
332
curve->get_point_left_mode(-12345) == Curve::TangentMode::TANGENT_FREE,
333
"get_point_left_mode() should return the expected value for invalid point index -12345.");
334
ERR_PRINT_ON;
335
336
CHECK_MESSAGE(
337
curve->get_point_count() == 4,
338
"Custom linear unit curve should contain the expected number of points.");
339
340
CHECK_MESSAGE(
341
Math::is_zero_approx(curve->sample(-0.1 * curve->get_domain_range() + curve->get_min_domain())),
342
"Custom linear curve should return the expected value at offset equivalent to a unit curve's -0.1.");
343
CHECK_MESSAGE(
344
curve->sample(0.1 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.4),
345
"Custom linear curve should return the expected value at offset equivalent to a unit curve's 0.1.");
346
CHECK_MESSAGE(
347
curve->sample(0.4 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.4),
348
"Custom linear curve should return the expected value at offset equivalent to a unit curve's 0.4.");
349
CHECK_MESSAGE(
350
curve->sample(0.7 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.8),
351
"Custom linear curve should return the expected value at offset equivalent to a unit curve's 0.7.");
352
CHECK_MESSAGE(
353
curve->sample(1 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(1),
354
"Custom linear curve should return the expected value at offset equivalent to a unit curve's 1.0.");
355
CHECK_MESSAGE(
356
curve->sample(2 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(1),
357
"Custom linear curve should return the expected value at offset equivalent to a unit curve's 2.0.");
358
359
CHECK_MESSAGE(
360
Math::is_zero_approx(curve->sample_baked(-0.1 * curve->get_domain_range() + curve->get_min_domain())),
361
"Custom linear curve should return the expected baked value at offset equivalent to a unit curve's -0.1.");
362
CHECK_MESSAGE(
363
curve->sample_baked(0.1 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.4),
364
"Custom linear curve should return the expected baked value at offset equivalent to a unit curve's 0.1.");
365
CHECK_MESSAGE(
366
curve->sample_baked(0.4 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.4),
367
"Custom linear curve should return the expected baked value at offset equivalent to a unit curve's 0.4.");
368
CHECK_MESSAGE(
369
curve->sample_baked(0.7 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.8),
370
"Custom linear curve should return the expected baked value at offset equivalent to a unit curve's 0.7.");
371
CHECK_MESSAGE(
372
curve->sample_baked(1 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(1),
373
"Custom linear curve should return the expected baked value at offset equivalent to a unit curve's 1.0.");
374
CHECK_MESSAGE(
375
curve->sample_baked(2 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx(1),
376
"Custom linear curve should return the expected baked value at offset equivalent to a unit curve's 2.0.");
377
378
ERR_PRINT_OFF;
379
curve->remove_point(10);
380
ERR_PRINT_ON;
381
CHECK_MESSAGE(
382
curve->sample(0.7 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.8),
383
"Custom free curve should return the expected value at offset equivalent to a unit curve's 0.7 after removing point at invalid index 10.");
384
CHECK_MESSAGE(
385
curve->sample_baked(0.7 * curve->get_domain_range() + curve->get_min_domain()) == doctest::Approx((real_t)0.8),
386
"Custom free curve should return the expected baked value at offset equivalent to a unit curve's 0.7 after removing point at invalid index 10.");
387
}
388
389
TEST_CASE("[Curve] Straight line offset test") {
390
Ref<Curve> curve = memnew(Curve);
391
curve->add_point(Vector2(0, 0));
392
curve->add_point(Vector2(1, 1));
393
394
CHECK_MESSAGE(
395
curve->sample_baked(1.0 - (0.5 / curve->get_bake_resolution())) != curve->sample_baked(1),
396
"Straight line curve should return different baked values at offset 1 vs offset (1 - 0.5 / bake resolution) .");
397
}
398
399
TEST_CASE("[Curve2D] Linear sampling should return exact value") {
400
Ref<Curve2D> curve = memnew(Curve2D);
401
real_t len = 2048.0;
402
403
curve->add_point(Vector2(0, 0));
404
curve->add_point(Vector2(len, 0));
405
406
real_t baked_length = curve->get_baked_length();
407
CHECK(len == baked_length);
408
409
for (int i = 0; i < len; i++) {
410
Vector2 pos = curve->sample_baked(i);
411
CHECK_MESSAGE(Math::is_equal_approx(pos.x, i), "sample_baked should return exact value");
412
}
413
}
414
415
TEST_CASE("[Curve3D] Linear sampling should return exact value") {
416
Ref<Curve3D> curve = memnew(Curve3D);
417
real_t len = 2048.0;
418
419
curve->add_point(Vector3(0, 0, 0));
420
curve->add_point(Vector3(len, 0, 0));
421
ERR_PRINT_OFF
422
real_t baked_length = curve->get_baked_length();
423
ERR_PRINT_ON
424
CHECK(len == baked_length);
425
426
for (int i = 0; i < len; i++) {
427
Vector3 pos = curve->sample_baked(i);
428
CHECK_MESSAGE(Math::is_equal_approx(pos.x, i), "sample_baked should return exact value");
429
}
430
}
431
432
} // namespace TestCurve
433
434