diff --git a/source/blender/blenkernel/intern/curves_geometry_test.cc b/source/blender/blenkernel/intern/curves_geometry_test.cc index 48493743cfc..b2e7d8f1d18 100644 --- a/source/blender/blenkernel/intern/curves_geometry_test.cc +++ b/source/blender/blenkernel/intern/curves_geometry_test.cc @@ -12,18 +12,26 @@ namespace blender::bke::tests { static CurvesGeometry create_basic_curves(const int points_size, const int curves_size) { - CurvesGeometry curves(points_size, curves_size); + /* Points count = E(points for each curve) = points * curves. */ + CurvesGeometry curves(points_size*curves_size, curves_size); - const int curve_length = points_size / curves_size; for (const int i : curves.curves_range()) { - curves.offsets_for_write()[i] = points_size * curve_length; + curves.offsets_for_write()[i] = points_size * i; } - curves.offsets_for_write().last() = points_size; for (const int i : curves.points_range()) { - curves.positions_for_write()[i] = {float(i), float(i % curve_length), 0.0f}; + curves.positions_for_write()[i] = {float(i / curves_size), float(i % points_size), 0.0f}; } + /* + For create_basic_curves(7, 4) it will build this like: + 0.0| | | |0,3 + | | | | + | | | | + | | | | + | | | | + 7,0| | | |7,3 + */ return curves; } //////////////////////////////////////////// TEST RESULT //////////////////////////////////////////// [----------] 8 tests from curves_geometry [ RUN ] curves_geometry.Empty [ OK ] curves_geometry.Empty (0 ms) [ RUN ] curves_geometry.Move [ OK ] curves_geometry.Move (0 ms) [ RUN ] curves_geometry.TypeCount [ OK ] curves_geometry.TypeCount (0 ms) [ RUN ] curves_geometry.CatmullRomEvaluation [ OK ] curves_geometry.CatmullRomEvaluation (0 ms) [ RUN ] curves_geometry.CatmullRomTwoPointCyclic [ OK ] curves_geometry.CatmullRomTwoPointCyclic (0 ms) [ RUN ] curves_geometry.BezierPositionEvaluation [ OK ] curves_geometry.BezierPositionEvaluation (0 ms) [ RUN ] curves_geometry.NURBSEvaluation [ OK ] curves_geometry.NURBSEvaluation (0 ms) [ RUN ] curves_geometry.BezierGenericEvaluation [ OK ] curves_geometry.BezierGenericEvaluation (0 ms) [----------] 8 tests from curves_geometry (0 ms total)