Does anyone have an implementation for AnglePath (see AnglePath Documentation and example usage) in Mathematica 10.0?
Answer
For the first usage, with an input list t of angles, I used:
anglePath[t_?VectorQ] :=
With[{a = Accumulate[t]},
Join[{{0., 0.}}, Accumulate[Transpose[{Cos[a], Sin[a]}]]]]
For the second usage, with an input matrix of {r,t} pairs, I used:
anglePath[t_?MatrixQ] :=
With[{a = Accumulate[t[[All, 2]]]},
Join[{{0., 0.}},
Accumulate[t[[All, 1]]*Transpose[{Cos[a], Sin[a]}]]]
]
Borrowing from the blog post:
Graphics[
{Thick,
MapIndexed[{ColorData["SandyTerrain", First[#2]/110], Line[#]} &,
Partition[anglePath[Table[{r,119.4*Degree},{r,0,1.1,0.01}]],
2, 1]]},
Background -> Black]

Comments
Post a Comment