Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
robotran
mbsysc
Commits
0ee35f5b
Commit
0ee35f5b
authored
Feb 09, 2021
by
Olivier Lantsoght
Browse files
[MBsysPy][Algebra][cross] Index_1 argument is converted only once to int.
parent
74130978
Changes
1
Hide whitespace changes
Inline
Side-by-side
MBsysC/mbs_interface/MBsysPy/mbs_algebra.py
View file @
0ee35f5b
...
...
@@ -210,13 +210,14 @@ def cross_product(v1, v2, vres=None, index_1=True):
if
vres
is
None
:
vres
=
np
.
zeros
(
3
+
index_1
)
# For faster reading, terms are aligned.
index_1
=
int
(
index_1
)
# required as array[True] is not array[1]
# For comprenhension:
# index_1
+ 0 is index [1], index_1 alone does not work as index_1 is True/False
# index_1
is index [1]
# index_1 + 1 is index [2]
# index_1 + 2 is index [3]
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
]
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
]
# And the previous formulaes are the cross product of 2 vector of 3 elements, first element being in index [1].
return
vres
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment