Commit 74130978 authored by Olivier Lantsoght's avatar Olivier Lantsoght
Browse files

[MBsysPy][cross] np.array[True] is not the same as np.array[1]

parent e4cf08ee
......@@ -211,12 +211,12 @@ def cross_product(v1, v2, vres=None, index_1=True):
vres = np.zeros(3 + index_1)
# For faster reading, terms are aligned.
# For comprenhension:
# index_1 alone is index [1]
# index_1 + 0 is index [1], index_1 alone does not work as index_1 is True/False
# index_1 + 1 is index [2]
# index_1 + 2 is index [3]
vres[index_1 ] = v1[index_1 + 1] * v2[index_1 + 2] - v1[index_1 + 2] * v2[index_1 + 1]
vres[index_1 + 1] = v1[index_1 + 2] * v2[index_1 ] - v1[index_1 ] * v2[index_1 + 2]
vres[index_1 + 2] = v1[index_1 ] * v2[index_1 + 1] - v1[index_1 + 1] * v2[index_1 ]
vres[index_1 + 0] = v1[index_1 + 1] * v2[index_1 + 2] - v1[index_1 + 2] * v2[index_1 + 1]
vres[index_1 + 1] = v1[index_1 + 2] * v2[index_1 + 0] - v1[index_1 + 0] * v2[index_1 + 2]
vres[index_1 + 2] = v1[index_1 + 0] * v2[index_1 + 1] - v1[index_1 + 1] * v2[index_1 + 0]
# And the previous formulaes are the cross product of 2 vector of 3 elements, first element being in index [1].
return vres
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment