The trails are vpython curve objects, which are a little strange. Here is an example curve, c:
import vpython as vpc = vp.curve(pos=[(0,0,0), (1,0,0), (2,1,0)], radius=0.05)The syntax for printing the position vector of the 3rd point is:
print( c.point(2)['pos'] )
which outputs
<2.000000, 1.000000, 0.000000>
(Using 2, not 3, as an input argument, because counting starts at 0 in python)
And for just the x-position, you'd use:
print( c.point(2)['pos'].x )and get
2.0as output.
This is because, as I understand it:
The curve
c has a method
point(...) which returns a
dict object, e,g,:
print( c.point(2) )
outputs
{'pos': <2.000000, 1.000000, 0.000000>, 'color': <1.000000, 1.000000, 1.000000>, 'radius': 0.05, 'visible': True, 'retain': -1}
dict objects work a little like arrays, except you feed them a string (the key) like 'pos' instead of an integer index.
So c.point(2) grabs the dict for the 3rd point in the curve c, and c.point(2)['pos'] grabs the 'pos' dictionary value <2.000000, 1.000000, 0.000000>
Hope this helps.