0
$\begingroup$

I've got a rectangular image with x and y in uniform space, and I want to twist it round a logarithmic spiral, so that the centreline of the x follows the spiral and all the space is filled. We can assume that the width of the image is a lot greater than the height.

So I need to derive a transform function from each pixel in x, y to a pixel in logarithmic space. Note the space-filling criterion is important, the top pixel at turn theta should be adjacent to the bottom pixel at theta - 2PI.

$\endgroup$
1
$\begingroup$

The filling occurs automatically in a parametric plot by incrementing $\beta$ parameter.

$$ r \rightarrow r\cdot ( \cos(\theta+ \beta), \sin(\theta + \beta)) $$

A single log spiral is given:

Say you wish to reach same $\theta$ after one rotation when radius $r$ increases from starting $r_1$

Log spiral has differential equation

$$ \frac{dr}{r d\theta}= \cot \alpha $$

and by integration polar equation is

$$ r = r_1\cdot e ^ {\cot\alpha \, \theta } \tag1 $$

$$ \alpha =\tan^{-1}[2 \pi/\log( r_2/r_1)]$$

If for example $r_1= 1$, $r_2= 16$, $\alpha $ calculates to $ \approx 1.15522$

Choose a small increment like $ \beta=\pi/30. $ This parameter rotates the entire log spiral by this increment.

$$ (x,y) = r_1\cdot e ^ {\cot\alpha \, \theta } ( \cos(\theta+ \beta), \sin(\theta + \beta)) \tag2 $$

enter image description here

$\endgroup$
6
  • $\begingroup$ See if I can understand this. I need to start at r1 = 1.0, so the image is 1pixel high. I can then give a free parameter which indicates the multiplication factor for a full turn. That gives me alpha, or the spiral tightness, using your equation. However I'm a bit shaky on beta. $\endgroup$ – Malcolm McLean Apr 27 '17 at 14:03
  • $\begingroup$ Does equn (2) makes it clear ? $\beta $ rotates each log spiral. $\endgroup$ – Narasimham Apr 27 '17 at 14:27
  • $\begingroup$ So I just need to rotate theta to correct for pixels off the x axis? $\endgroup$ – Malcolm McLean Apr 27 '17 at 14:30
  • $\begingroup$ Right, but all around the origin, not just x- or y- axis. Can you show how you work with pixels? I cannot figure out much here although input is only geometrical. $\endgroup$ – Narasimham Apr 27 '17 at 17:05
  • $\begingroup$ Essentially I have an image which is rectangular and a lot wider than it is high, say 25 pixels by 1000 pixels. It might contain text. I want the text to be scaled, in a space filling manner, round the log curve. So I imagine that y = 12.5 would be the line on the curve itself. But y= 0 should touch y = 26 on the previous loop. $\endgroup$ – Malcolm McLean Apr 28 '17 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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