Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Ultimately the goal is to make a manipulate command and turn a line into a circle.

So I am supposed to take a line that is segmented into 12 equal lengths.

M = {{1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}, {7, 0}, {8, 
0}, {9, 0}, {10, 0}, {11, 0}, {12, 0}, {13, 0}};
Graphics[{Thin, 
Line[M, VertexColors -> {Red, Blue, Orange, Green, Red, Blue, 
 Orange, Green, Red, Blue, Orange, Green}]}]

Then there is the circle

L = {{1, 0}, {Cos[Pi/6], Sin[Pi/6]}, {Cos[(2 Pi)/6], 
Sin[(2 Pi)/6]}, {0, Sin[Pi/2]},  {-Cos[(2 Pi)/6], 
Sin[(2 Pi)/6]}, {-Cos[Pi/6], Sin[Pi/6]},   {-1, 
0} , {-Cos[Pi/6], -Sin[Pi/6]},    {-Cos[(2 Pi)/6], -Sin[(2 Pi)/
  6]}, {0, -1},   {Cos[(2 Pi)/6], -Sin[(2 Pi)/6]}, {Cos[
 Pi/6], -Sin[Pi/6]}, {1, 0}} ;

Graphics[{Thin, 
Line[ { L   }, 
VertexColors -> {Yellow, Red, Blue, Orange, Green, Red, Blue, 
 Orange, Green, Red, Blue}]}]

Now I am trying to merge the two. I noticed whenever I start of with the line command I can't get it to work with manipulate.

Manipulate[Thin, 
Line[ Plot[{{1, 0}, {2, 0}}, {x, 0, 3}], {a, 0, 2 Pi}  ]

So now I am not sure how to go about the problem since I can't even begin on it. Should I just use the equation of a line? That doesn't seem probably given the question

If you take a fraction f of a final vertex and a fraction 1-f of the corresponding initial vertex, and vary f between zero and one, you will find that a shape evolves from the initial shape to the final shape. Construct a Manipulate[] function with a slider that varies f that shows your straight line curling up into a circle.

Which makes me think that I need to have the individual vertices's in. Please help, thank you

share|improve this question
    
Not so didactic, but the morphing follows the principle from your assignment: mathematica.stackexchange.com/a/31642/131. –  Yves Klett Oct 20 '13 at 7:13
add comment

1 Answer 1

m = {#, 0} & /@ Range@13;
l = Table[{Cos[2 Pi n/12], Sin[2 Pi n /12]}, {n, 13}];
Manipulate[Graphics[{Thin, 
   Line[l, VertexColors -> {Yellow, Red, Blue, Orange, Green, Red, 
                            Blue, Orange, Green, Red, Blue}], 
   Line[m, VertexColors -> {Red, Blue, Orange, Green, Red, Blue, 
                            Orange, Green, Red, Blue, Orange, Green}],
   Line[f l + (1 - f) m]}], {f, 0, 1}]

Mathematica graphics

share|improve this answer
    
@Megan Vineyard you can upvote an answer if you like it, too ;-) –  Yves Klett Oct 22 '13 at 6:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.