ich have folgenden Code:
Code: Alles auswählen
positions = [
[[ 1.0, 0.0, 0.0, 0.0], #x
[ 0.0, 1.0, 0.0, 0.0], #y
[ 0.0, 0.0, 1.0, 0.0], #z
[ 0.0, 0.0, 0.0, 1.0]]
]
for p in positions:
p[0][0] = 4711
print(positions)
Code: Alles auswählen
>>> %Run test.py
[[[4711, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]]
>>>
Code: Alles auswählen
positions = [
[[ 1.0, 0.0, 0.0, 0.0], #x
[ 0.0, 1.0, 0.0, 0.0], #y
[ 0.0, 0.0, 1.0, 0.0], #z
[ 0.0, 0.0, 0.0, 1.0]]
]
for p in positions:
x = p.copy()
x[0][0] = 4711
print(positions)
Code: Alles auswählen
>>> %Run test.py
[[[4711, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]]
>>>
Hintergrund, ich habe eine Liste von Matrizen für homogene Koordinaten, insgesamt 12 an der Zahl. Diese 12 sollen nun dupliziert werden und eine Translation hinzugefügt werden.
Also aus
Code: Alles auswählen
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
Code: Alles auswählen
1 0 0 dx
0 1 0 dy
0 0 1 dz
0 0 0 1
//Huebi