Skip to content

Commit e995de6

Browse files
BUG: Vector encoding breaks MonteCarlo export. (#704)
* BUG: Vector encoding breaks MonteCarlo export. * MNT: add changes to CHANGELOG. * ENH: make the Matrix class JSON serializable --------- Co-authored-by: Gui-FernandesBR <[email protected]>
1 parent 9d34c7e commit e995de6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Attention: The newest changes should be on top -->
4040

4141
### Fixed
4242

43-
-
43+
- BUG: Vector encoding breaks MonteCarlo export. [#704](https://github.com/RocketPy-Team/RocketPy/pull/704)
4444

4545
## [v1.6.0] - 2024-09-29
4646

rocketpy/mathutils/vector_matrix.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,10 @@ def k():
418418
"""Returns the k vector, [0, 0, 1]."""
419419
return Vector([0, 0, 1])
420420

421+
def to_dict(self):
422+
"""Returns the vector as a JSON compatible element."""
423+
return list(self.components)
424+
421425

422426
class Matrix:
423427
"""Pure Python 3x3 Matrix class for simple matrix-matrix and matrix-vector
@@ -998,6 +1002,10 @@ def __repr__(self):
9981002
+ f" [{self.zx}, {self.zy}, {self.zz}])"
9991003
)
10001004

1005+
def to_dict(self):
1006+
"""Returns the matrix as a JSON compatible element."""
1007+
return [list(row) for row in self.components]
1008+
10011009
@staticmethod
10021010
def identity():
10031011
"""Returns the 3x3 identity matrix."""

0 commit comments

Comments
 (0)