diff --git a/CHANGELOG.md b/CHANGELOG.md index cf4da0a72..dfe3c4407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,7 +40,7 @@ Attention: The newest changes should be on top --> ### Fixed -- +- BUG: Vector encoding breaks MonteCarlo export. [#704](https://github.com/RocketPy-Team/RocketPy/pull/704) ## [v1.6.0] - 2024-09-29 diff --git a/rocketpy/mathutils/vector_matrix.py b/rocketpy/mathutils/vector_matrix.py index 82b5475f1..0da44935d 100644 --- a/rocketpy/mathutils/vector_matrix.py +++ b/rocketpy/mathutils/vector_matrix.py @@ -418,6 +418,10 @@ def k(): """Returns the k vector, [0, 0, 1].""" return Vector([0, 0, 1]) + def to_dict(self): + """Returns the vector as a JSON compatible element.""" + return list(self.components) + class Matrix: """Pure Python 3x3 Matrix class for simple matrix-matrix and matrix-vector @@ -998,6 +1002,10 @@ def __repr__(self): + f" [{self.zx}, {self.zy}, {self.zz}])" ) + def to_dict(self): + """Returns the matrix as a JSON compatible element.""" + return [list(row) for row in self.components] + @staticmethod def identity(): """Returns the 3x3 identity matrix."""