Message Boards Message Boards

0
|
2130 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Generate a list of arrows that follows one another

Posted 2 years ago

I have the following list of vectors:

vecs = {
  {a1, a2},
  {b1, b2},
  {c1, c2},
  {d1, d2},
  {e1, e2},
  {f1, f2}
  }

and I want to generate the following list:

{
 Arrow[{{0, 0}, {a1, a2}}],
 Arrow[{{a1, a2}, {b1, b2}}],
 Arrow[{{b1, b2}, {c1, c2}}],
 Arrow[{{c1, c2}, {d1, d2}}],
 Arrow[{{d1, d2}, {e1, e2}}],
 Arrow[{{e1, e2}, {f1, f2}}]
 }

How can I do that?

POSTED BY: Ehud Behar
3 Replies

Here is another way - a single line with several arrow heads:

{Arrowheads[{0, 0.1, 0.1, 0.1, 0.1, 0.1}], Arrow[vecs]}

EDIT: Works best if all vectors have the same lenght.

POSTED BY: Henrik Schachner
Posted 2 years ago

Here's one way:

Arrow /@ Partition[vecs, 2, 1, {-1, -1}, {{0, 0}}]
POSTED BY: Eric Rimbey
Posted 2 years ago

First time that I make use of the function Partition. Very nice and thank you very much!

POSTED BY: Ehud Behar
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract