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.

Referring to this link I happen to realize that actually the trace being projected is dependent on an equation and not on disk or circle. Though I was presuming that it is getting traced because of the movement of circle/disk. So, in mathematica is it possible that the object can be traced automatically, say the same output of cycloid program without using parametric equations for trace of point on circle.

share|improve this question
1  
You could extract the coordinates for elements in a graph if they are unique, say there is only one Disk[] in the graph. Ideally you'd need a way to tag the points you may want to extract later but I don't think there is a way to attach such labels to Mathematica Graphics elements. One possible solution would be to Sow[] the information as you build up the plot, then Reap[] the information you need later if you choose to. –  SEngstrom May 11 '13 at 16:16
    
You could always use a particle filter... :D –  rm -rf May 11 '13 at 16:18
    
@rm-rf: can you elaborate more on this particle filter concept? –  Rorschach May 11 '13 at 16:28
1  
@rafiki It was a little tongue-in-cheek... While it is true that particle filters are very useful in real world tracking applications (see this video of the man with a glowing butt, for an example), it is overkill for the application you suggest. Something like what SEngstrom suggested (extract coordinates of interest) is what I would do as well. –  rm -rf May 11 '13 at 16:36
1  
@rm-rf A particle filter ... kind of reference.wolfram.com/mathematica/ref/ImageFeatureTrack.html (see "Neat Examples") –  belisarius May 12 '13 at 19:38

1 Answer 1

up vote 7 down vote accepted
h = {Disk[], Red, PointSize[Large], Point[{1, 0}]};
r = Image@Total[ImageData /@ (ColorSeparate /@ 
               Table[
                      Graphics[{Translate[Rotate[h, - 2 t/(Pi)], {t, 0}]}, 
                                 PlotRange -> {{0, 6 Pi}, {-1, 1}}, Background -> Black], 
                      {t, 0, 6 Pi, 2 Pi/20}])[[All, 1]]]

enter image description here

enter image description here

Edit (Perhaps cleaner)

(*the object to trace*)
h = {Disk[], Red, PointSize[Medium], Point[{1, 0}]};

obj[t_, col_] := Graphics[Translate[Rotate[h, -2 t/(Pi)], {t, 0}], 
                          PlotRange -> {{0, 6 Pi}, {-1, 1}}, Background -> col];
dt = Pi/20;

tr[0, dt] = First@ColorSeparate[obj[0, Black]];
tr[t_, dt_] :=  tr[t, dt] = ImageAdd[tr[t - dt, dt], First@ColorSeparate[obj[t, Black]]];

Animate[ ImageCompose[ImageMultiply[tr[t, dt], Red], {obj[t, White], .6}], {t, 0, 6 Pi, 2 Pi/20}]

enter image description here

share|improve this answer
    
awesome........ –  SEngstrom May 12 '13 at 4:00
    
Is your code supposed to show the rotating disk with the red dot (from the bottom half of the figure in your post) too? Because I'm only getting the cycloid trace. –  Aky May 12 '13 at 8:37
    
@Aky Take a look at the edit –  belisarius May 12 '13 at 16:01

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.