Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interpolation/smoothing in Mathematica using Graphics

I am trying to smooth the path I draw between points.

Please consider :

 lesPoints = {{41, 26}, {42, 29}, {41, 31}, {46, 30}, {48, 30}, 
              {40, 30}, {43, 30}, {47, 30}, {48, 26}, {47, 20}}

Those are the real eye fixations coordinates I use to trace the temporal path.

This is the way I plot them now :

Graphics[{
         Table[Arrow[{lesPoints[[i]], lesPoints[[i + 1]]}], 
              {i,Length[lesPoints] - 1}], 
         MapThread[Text[Style[#1, Large, FontFamily -> "Impact"], {#2, #3}] &, 
         PrependTo[Transpose[lesPoints], Range[1, Length@lesPoints]]]}]

enter image description here

I could not get anything right in my attempt to use interpolation.

Would it be a good way to smooth the path, what would be an alternative ?

like image 948
500 Avatar asked Feb 06 '26 00:02

500


1 Answers

What about something like this

lesPoints = {{41, 26}, {42, 29}, {41, 31}, {46, 30}, {48, 30}, 
          {40, 30}, {43, 30}, {47, 30}, {48, 26}, {47, 20}}

interpolation = Interpolation[Table[{i, lesPoints[[i]]}, {i, Length[lesPoints]}]]

The path then becomes something like

plot = ParametricPlot[interpolation[t], {t, 1, Length[lesPoints]}];
Show[plot, Graphics[{Red, PointSize[0.02], Point /@ lesPoints}], Axes -> False]

Result:

smooth curve

like image 120
Heike Avatar answered Feb 09 '26 16:02

Heike