pybricks.tools: Document cross product.

This commit is contained in:
Laurens Valk
2023-04-21 13:39:08 +02:00
parent 9cde749e8a
commit 870aae83c0
3 changed files with 18 additions and 0 deletions
+2
View File
@@ -31,3 +31,5 @@
.. pybricks-requirements:: stm32-float
.. autofunction:: pybricks.tools.vector
.. autofunction:: pybricks.tools.cross
+1
View File
@@ -155,6 +155,7 @@ def test_from_pybricks_tools_import():
code = "from pybricks.tools import "
completions: list[CompletionItem] = json.loads(complete(code, 1, len(code) + 1))
assert [c["insertText"] for c in completions] == [
"cross",
"DataLog",
"Matrix",
"StopWatch",
+15
View File
@@ -207,6 +207,21 @@ def vector(*args):
"""
def cross(a: Matrix, b: Matrix) -> Matrix:
"""
cross(a, b) -> Matrix
Gets the cross product ``a`` × ``b`` of two vectors.
Arguments:
a (Matrix): A three-dimensional vector.
b (Matrix): A three-dimensional vector.
Returns:
The cross product, also a three-dimensional vector.
"""
# HACK: hide from jedi
if TYPE_CHECKING:
del Number