Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to map my data on Archimedes' spiral and preserve the distance between points on the curve. The test data consists of 20 evenly spaced {x,y} coordinates:

data = Table[{i, i}, {i, 20}]

When I map the data to a spiral, the points are not evenly spaced anymore:

Show[ListPlot[{#[[2]] Sin[#[[1]]], #[[2]] Cos[#[[1]]]} & /@ data, 
  AspectRatio -> 1, PlotRange -> {{-20, 20}, {-20, 20}}], 
 ParametricPlot[{t Sin[t], t Cos[t]}, {t, 0, 20}]]

Mathematica graphics

I found this question that links to the algorithm that iteratively generates evenly distributed points on a spiral, but how can I apply this to my set of data points?

The final goal that I'm trying to achieve is to create a function that I can use with ImageTransformation that will remap an image that roughly resembles a line to an Archimedes' spiral.

share|improve this question
Related: (8454) – C. E. Aug 19 '14 at 11:52
@Pickett Thanks, I saw this, but again this uses the approach to subdivide a predefined curve. I don't think I can use this because my data will contain noise, and therefore I cannot directly assign my data points to the pre-generated points on a curve. – shrx Aug 19 '14 at 12:00
Maybe changing your data to Sqrt[2 #] & /@ Table[{i, i}, {i, Range[0, 1/2 20^2, 1/2 20]}] or similar ? – b.gatessucks Aug 19 '14 at 12:05
@b.gatessucks yes, this looks like I could use it – shrx Aug 19 '14 at 12:09
Somewhat related: (655857) – Mr.Wizard Aug 19 '14 at 20:38
up vote 7 down vote accepted

Using @b.gatessucks' hint, I solved it with the following transformation:

max = Max[data]; 
  ListPlot[{Sqrt[max #[[2]]] Sin[Sqrt[max #[[1]]]], 
            Sqrt[max #[[2]]] Cos[Sqrt[max #[[1]]]]} & /@ data, 
    AspectRatio -> 1, PlotRange -> {{-20, 20}, {-20, 20}}], 
  ParametricPlot[{t Sin[t], t Cos[t]}, {t, 0, 20}]]

Mathematica graphics

share|improve this answer

Borrowing from Szcabolcs' answer here:


PointsOnCurve[fun_, lim_, points_] :=

 Module[{arclength, curvepoints},

  arclength = 
   Derivative[-1][FunctionInterpolation[Evaluate @ Norm @ D[fun, t], {t, 0, lim}]];

  curvepoints = fun /. t -> # & /@
      Table[InverseFunction[arclength][x], {x, 0, #, # / points}] & [arclength[lim]];

   ParametricPlot[fun, {t, 0, lim}],
   Graphics[{Red, PointSize[0.02], Point[curvepoints]}]]]

PointsOnCurve[{t Sin[t], t Cos[t]}, 20, 30]

enter image description here

PointsOnCurve[{Cos[t], Sin[2 t]}, 2 Pi, 30]

enter image description here

share|improve this answer
You use the variable points twice, as number of points, and as a points list – hieron Aug 19 '14 at 13:05
@hieron Thanks, very attentive, I changed the answer – eldo Aug 19 '14 at 13:13
Switching off the message is not needed if you define spiral SetDelayed, which simplifies also the spiralpoints expression. – hieron Aug 19 '14 at 13:52
I am not looking for a function to generate the points, I want to remap the points that I will obtain experimentally. – shrx Aug 19 '14 at 15:03

Your Answer


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.