how to call the x component of a vector in python
Watch
Announcements
Page 1 of 1
Skip to page:
how would you write the x component of :
a = sphere(pos = vector(1,2,3)) *example
a = sphere(pos = vector(1,2,3)) *example
0
reply
Report
#2
(Original post by localmemelord)
how would you write the x component of :
a = sphere(pos = vector(1,2,3)) *example
how would you write the x component of :
a = sphere(pos = vector(1,2,3)) *example
0
reply
(Original post by MrSandyWilly)
That doesn't look like correct Python to me... what module is this?
That doesn't look like correct Python to me... what module is this?
0
reply
0
reply
Report
#6
a.pos[0]? I'm assuming sphere is a class
never heard of vpython, I'd have just used a numpy array
never heard of vpython, I'd have just used a numpy array
Last edited by Sinnoh; 1 month ago
0
reply
(Original post by Sinnoh)
a.pos[0]? I'm assuming sphere is a class
never heard of vpython, I'd have just used a numpy array
a.pos[0]? I'm assuming sphere is a class
never heard of vpython, I'd have just used a numpy array
"'vpython.cyvector.vector' object is not subscriptable"
0
reply
Report
#8
(Original post by localmemelord)
that doesnt work unfortunately, a typeerror forms:
"'vpython.cyvector.vector' object is not subscriptable"
that doesnt work unfortunately, a typeerror forms:
"'vpython.cyvector.vector' object is not subscriptable"
It must have its own method for calling the component then
0
reply
0
reply
Report
#10
What about print()
See the bottom of the documentation page:
https://www.glowscript.org/docs/VPyt...sualIntro.html
See the bottom of the documentation page:
https://www.glowscript.org/docs/VPyt...sualIntro.html
0
reply
(Original post by just_m3)
What about print()
See the bottom of the documentation page:
https://www.glowscript.org/docs/VPyt...sualIntro.html
What about print()
See the bottom of the documentation page:
https://www.glowscript.org/docs/VPyt...sualIntro.html
0
reply
Report
#12
(Original post by localmemelord)
wouldnt that print out all of the components instead of only the x component
wouldnt that print out all of the components instead of only the x component
1
reply
X
Page 1 of 1
Skip to page:
Quick Reply
Back
to top
to top