Skip to content

Commit 1011681

Browse files
committed
Fix broken VectorND.fill_array
1 parent b7c5ebe commit 1011681

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

math/vector_nd.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ VectorN VectorND::fill(const int64_t p_dimension, const double p_value) {
350350
Vector<VectorN> VectorND::fill_array(const int64_t p_dimension, const int64_t p_vector_amount, const double p_value) {
351351
Vector<VectorN> filled_array;
352352
filled_array.resize(p_vector_amount);
353-
const VectorN filled_vector = fill(p_value, p_dimension);
353+
const VectorN filled_vector = fill(p_dimension, p_value);
354354
for (int64_t i = 0; i < p_vector_amount; i++) {
355355
filled_array.set(i, filled_vector);
356356
}
@@ -928,6 +928,18 @@ String VectorND::to_string(const VectorN &p_vector) {
928928
return str;
929929
}
930930

931+
String VectorND::to_string(const Vector<VectorN> &p_vectors) {
932+
String str = "[";
933+
for (int64_t i = 0; i < p_vectors.size(); i++) {
934+
str += VectorND::to_string(p_vectors[i]);
935+
if (i < p_vectors.size() - 1) {
936+
str += ", ";
937+
}
938+
}
939+
str += "]";
940+
return str;
941+
}
942+
931943
VectorND *VectorND::singleton = nullptr;
932944

933945
void VectorND::_bind_methods() {

math/vector_nd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class VectorND : public Object {
119119
static Vector3 to_3d(const VectorN &p_vector);
120120
static Vector4 to_4d(const VectorN &p_vector);
121121
static String to_string(const VectorN &p_vector);
122+
static String to_string(const Vector<VectorN> &p_vectors);
122123

123124
static VectorND *get_singleton() { return singleton; }
124125
VectorND() { singleton = this; }

0 commit comments

Comments
 (0)