Skip to content

Instantly share code, notes, and snippets.

@mango314
Last active August 29, 2015 14:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mango314/e1f7d5e63a46d62b547a to your computer and use it in GitHub Desktop.
Save mango314/e1f7d5e63a46d62b547a to your computer and use it in GitHub Desktop.
various constructions of the Limaçon curve

Wikipedia: Let P be a point and C be a circle whose center is not P. Then the envelope of those circles whose center lies on C and that pass through P is a limaçon.

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize']=6,6
def myCircle(z,r, N=50):
dt = 1.0/N
t = np.arange(0,1+dt,dt)
return z + r*np.exp(2j*np.pi*t)
N = 50
W = myCircle(0,1)
plt.plot(W.real, W.imag, linewidth=2, c='#C96640')
plt.plot([0],[0], 'o', markersize=5)
P = 2j*np.exp(2j*np.pi*0)
plt.plot(P.real,P.imag, 'o',markersize=5)
for w in W[:]:
b = myCircle( 0.5*(w + P), np.abs(0.5*(w-P)))
plt.plot(b.real, b.imag, '#798B6E', alpha=0.35)
plt.axis("Equal")
plt.grid(True)
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
plt.rcParams['figure.figsize']=6,6
N = 400
w = myCircle(0,1,N=N)
P = 2j
pts = []
for k in range(N):
a = w[k] + 2j*w[k]
b = w[k] - 2j*w[k]
Q = P - (((P)*np.conj(w[k])).real - 1)*w[k]
plt.plot([P.real, Q.real], [P.imag, Q.imag], 'r-',markersize=5, alpha=0.5)
pts += [Q]
pts = np.array(pts)
plt.plot(pts.real, pts.imag, '-')
plt.axis("Equal")
plt.grid(True)
plt.xlim([-2,2])
plt.ylim([-1.5,2.5])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment