I am considering the following case. Say that T={p1,p2,p3}
represents a triangle. In addition, I want to parameterize the edges of the triangle T
. What I currently do is:
edgesT = {
t T[[1]] + (1 - t) T[[2]],
t T[[2]] + (1 - t) T[[3]],
t T[[3]] + (1 - t) T[[1]]};
This seems to be very naive, and I would like to learn how can I improve this. One, somehow obvious, way would be to have a cyclic list. Thus the question's title.
Is there a (smart) way to treat a list as cyclic?
Obviously, T[[i]] = pi
for i={1,2,3}
. It could be useful, for example in the example above, to enter T[[4]]
and expect to have p1
as an output. Is there some way to do it?
If not, how can I improve the definition above?