While writing some code playing around with projections, I noticed that there seems to be a link between circle and ellipses:
What my code and what happens:
I create a circle and randomly choose a point $P$ in the plane. Then I connect $P$ with (all) points $P_i$ of the circle via a straight line and look at the set of all points $P_{d, i}$ that are all a certain relative distance $d, 0 \lt d \lt 1$ away from $P$.
I noticed that, if $P$ is outside the circle the $P_{1, i}$ , $P_{2, i}$, $\dots$ - seem to form circles.
However, if $P$ is inside: I seem to get ellipses and $P$ being in one of the two focus points! How come? How are circle and ellipsis related? I am pretty sure this can be verified by simply plugging in the numbers, however can this also be rather derived by intuition than by number crunching? I would like to understand this topic better, however I don't know its exact terms or field in mathematics, so I would also be very happy, if someone could provide information for further reading and self study.
Below I provided the code and two images illustrating the results I got.
import math as math
import matplotlib.pyplot as plt
import numpy as np
import random as rng
def frange(start, stop, step):
l = list()
i = start
while i < stop:
yield i
l.append(i)
i += step
return l
def connect_points(a, b):
if(b[0] == a[0] or b[1] == a[1]): return []
m = (b[1] - a[1]) / (b[0] - a[0])
X = list()
Y = list()
l = np.arange(0, 1, 0.1)
for t in l:
X.append(a[0] * t + (1 - t) * b[0])
Y.append(a[1] * t + (1 - t) * b[1])
return np.array(X), np.array(Y)
r = 3
circ_X = list()
circ_Y = list()
sp = [rng.randrange(-1, 1), rng.randrange(-1, 1)]
numP = 0
for i in frange(-3.0, 3.0, 0.01):
for j in frange(-3.0, 3.0, 0.01):
if(math.fabs(i ** 2 + j ** 2 - 3) < 0.01):
circ_X.append([i])
circ_Y.append([j])
numP = numP + 1
for i in range(numP):
cp = np.array([circ_X[i], circ_Y[i]])
x, y = connect_points(cp, sp)
plt.plot(x, y, ',')
plt.plot(circ_X, circ_Y, ',')
plt.plot(sp[0], sp[1], ',')
plt.xlim(-3, 3)
plt.ylim(-3, 3)
plt.show()


Straight lines in the $x$-$y$ plane can be described as solutions to the equation $$ a x + b y + c = 0 $$ If we consider quadratic terms in the variables we deal with equations $$ a x^2 + b xy + c y^2 + d x + e y + f = 0 $$ which describe so called conic sections, due to the classical geometric problem of cutting a 3D cone with a plane.
The possible solutions are classified into parabolic, hyperbolic and elliptic solutions. The linear part will be mostly responsible to encode translation and rotation. There are also some special, so called degenerate solutions.
Elliptic solutions can be transformed into the solutions of the equation $$ (x/a)^2 + (y/b)^2 = 1 $$ which are ellipses with semi axes $a$ and $b$.
The special case $a=b$ describes a circle around the origin with radius $r$, we mostly write it as solution to the equation $$ x^2 + y^2 = r^2 $$
Summary:
So in short: ellipses and circles are related, the circle is a special case of the ellipse. Both are solutions to second order equations. The cases with different origin, scale and rotation are handeled by the general second order equation, where the parameters will be subject to certain conditions.
Appendix: Classification
The quadratic equation can be written in matrix form as $$ \begin{pmatrix} x & y \end{pmatrix} \underbrace{ \begin{pmatrix} a & b/2 \\ b/2 & c \end{pmatrix} }_Q \begin{pmatrix} x \\ y \end{pmatrix} + \begin{pmatrix} d & e \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} + f = 0 $$ The first part $u^\top Q u$ is called a quadratic form. If $\det Q = \lambda_1 \lambda_2 > 0$ we have either all positive or all negative eigenvalues, $Q$ is definite and the solution is an ellipse. For $Q$ diagonal and $a=c$ we have a circle.
Appendix: Scaling
Above is your image scaled such, that the $[-3,3]$ intervals have the same size.