# How to find the center of a log spiral?

Given just a few points on a log spiral, how to find the center? Considering that the circle is a degenerate case of the log spiral, is there a way to generalize the method for finding circle centers (i.e. via Euclid III.1)?

I see here that the center of the golden log spiral is found at the point where the long diagonals of the inscribing golden rectangles meet. Alternatively, inscribed golden triangles can be used. Perhaps there is some way to generalize this method to all log spirals?

• (1) Note that the so-called golden spiral you linked is just an approximation to the golden logarithmic spiral with golden ratio. (2) A golden log-spiral indeed fits with an infinite sequence of golden rectangle (or triangle), however it is NOT inscribed in them. The spiral is not tangent to any of the sides but intersects any side for a 2nd time after the supposed "touching" point. (3) How do you imagine such a rectangle can be constructed exactly (not just fitting by trial) given a spiral but not its center? May 7, 2018 at 3:19
• Before asking for generalization, you should first make sure what is it that can be done with a golden log-spiral. May 7, 2018 at 3:21

A logarithmic spiral has the property that rays from the center cut the spiral at the same angle $\alpha$. So if you had tangents at two points $p_1, p_2$ on the curve, you could hypothesize a center $(x,y)$, compute the angles $\alpha_1, \alpha_2$, and require $\alpha_1=\alpha_2$.

Red rays make different angles with tangents; green rays make same angle, $107^\circ$.
That gives you one equation in the two unknowns $(x,y)$. So, barring degeneracies, tangents at three distinct points would permit solving for $(x,y)$.

This approach requires enough points of the spiral to determine (or approximate) three distinct tangents.

• Could you write the equations that are needed to be solved? Feb 19, 2019 at 20:55
• Instead of a curve I have a set of points or a polyline. How to apply proposed method to polyline? I suggest that it approximates the logarithmic spiral. Feb 20, 2019 at 10:04
• @IvanBunin: Sorry, I do not have time right now to detail the calculation. Feb 20, 2019 at 13:50

You might find "A Note on the Centroid of a Logarithmic Spiral Sector" useful: https://www.icevirtuallibrary.com/doi/10.1680/geot.1956.6.2.66

You can probably use some ideas of the solution I'been working around (most probably not the cleanest way)

The formula for the spiral is $$r=a e^{b\theta}$$

Given that you have a list of points (list of (r, $$\theta$$) pairs), the value of "b" and the solution of @joseph-orourke, you can find the center of the spiral like this.

The idea is to:

• Get the tangent line equations
• Find intersection between radius lines (center of spiral)

The full example is on python code

1. Get the tangent equation of two spiral points. The "right" way to get tangent equations is to use the derivative of the spiral (you can check that here). That is something messy for me, so I just use two very close points to build the tangent lines $$(x_1, y_1) , (x_2, y_2)$$

• slope $$m = \frac{y_2 - y_1}{x_2 - x_1}$$

• intercept $$c = y_1 - mx_1$$

2. The next thing is to calculate the radius line equation $$y = mx + c$$

2.1 The formula of intersection between two lines (tangent and radius lines) reference

$$\tan{\delta} = \frac{m_2 - m_1}{1 + m_1m_2}$$

2.2 The angle $$\delta$$ between the tangent and radial line at the point (r, theta) reference

$$\delta = \tan^{-1} {( \frac{1}{b} )}$$

2.3 Replace $$\delta$$ on the first equation and get slope of the radius line.

$$\tan{\delta} = \frac{m_2 - m_1}{1 + m_1m_2}$$

$$\tan{ \tan^{-1} {( \frac{1}{b} )} } = \frac{m_2 - m_1}{1 + m_1m_2}$$

$$\frac{1}{b} = \frac{m_2 - m_1}{1 + m_1m_2}$$

$$m_1 = \frac{m_2 - \frac{1}{b} }{m_2\frac{1}{b} + 1}$$

2.4 Get intercept

$$c = y_1 - m_1x_1$$

2.5 In the end you got the radius line using the tangent equation and the angle $$\delta$$.

$$y = m_1x + c$$

1. The last step is to choose 2 different points on the spiral, find two radius equation and find their intersection.

In the image, tangent lines are red, radius lines are green. (do not have enough reputation points to show the graph as embedded image)

graph

The best way to understand this with the code.

import numpy as np
import matplotlib.pyplot as plt
import math

# Spiral definition
a = 0.5
b = 0.20
th = np.linspace(0, 6*math.pi, 1000)
x0, y0 = 2.5, 3.7 # Initial center of spiral
x = a*np.exp(b*th)*np.cos(th) + x0
y = a*np.exp(b*th)*np.sin(th) + y0

plt.plot(x, y)

# Points on spiral
x1, x2 = x[500:502]
y1, y2 = y[500:502]

x3, x4 = x[800:802]
y3, y4 = y[800:802]

plt.scatter([x1, x3], [y1, y3], s=10, c='b'  )

# Calculate slope and intercept using two points
def get_equation(p1, p2):
x1, y1 = p1
x2, y2 = p2

m = (y2 - y1)/(x2 - x1)
b = y1 - m*x1
return m, b

# Plot line function
def plot_line(x1, x2, m, b, c='red'):
x = np.linspace(x1, x2, 100)
y = m*x + b
plt.plot(x, y, c=c)

# Tangent equations of points in spiral
m1, b1 = get_equation((x1, y1) , (x2, y2))
m2, b2 = get_equation((x3, y3) , (x4, y4))

plot_line(-1, -0.5, m1, b1)
plot_line(-7, -4, m2, b2)

# Calculate radius line of first tangent line
t1 = 1/b
m01 = (m1 - t1)/(m1*t1 + 1)
b01 = y1 - m01*x1
plot_line(-1, 3, m01, b01, c='g')

# Calculate radius line of second tangent line
m02 = (m2 - t1)/(m2*t1 + 1)
b02 = y3 - m02*x3
plot_line(-7, 3, m02, b02, c='g')

# Calculate intersection between the two radius lines
x0 = (b02 - b01)/(m01 - m02)
y0 = m01*x0 + b01
print(x0, y0)
plt.scatter([x0], [y0], s=20, c='black' , zorder=0 )

plt.show()


The spiral is completely determined by four parameters: the coordinates of the center and the coefficients in the exponent. If you know four points of the curve, you can establish a system of four equations in four unknowns.

Unfortunately, the system is highly non-linear.