What is the relationship between circles and ellipses? 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()

 A: 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.
A: If I understand your description correctly, you’re taking line segments from $P$ to each point of the base circle and computing the locus of points that are some fixed fraction $d$ of the segment length away from $P$.  
W.l.o.g. we can take the unit circle for the base circle and place $P$ on the nonnegative $x$-axis at $(p,0)$. Every other configuration can be obtained from this one via a similarity transformation, which doesn’t change the overall shape of the curves. A parameterization of the resulting curve is therefore $(1-d)(p,0)+d(\cos t,\sin t)$, or $$\begin{align} x &= (1-d)p + d\cos t \\ y &= d\sin t. \end{align}$$ Eliminating $t$ yields the implicit Cartesian equation $$\left(x-(1-d)p\right)^2+y^2 = d^2.$$ This is the equation of a circle of radius $d$ centered at $\left((1-d)p,0\right)$. Any ellipses that you’re seeing (including the base circle!) are artifacts of the way that you’re displaying the resulting curves, as Arthur has noted in a comment.  
That aside, circles are in a sense special cases of ellipses: they are ellipses for which the axis lengths are equal and the foci coincide. Every ellipse is an affine image of the unit circle, so by extension, all ellipses (and circles) are relative by affine transformations. In fact, the illusion of ellipses in your plots illustrates this: the coordinate system has unequal $x$- and $y$-scales, which corresponds to an affine transformation of the standard coordinate system, changing all of those circles into ellipses. In terms of classic conic sections, ellipses are obtained by cutting a right circular cone with a plane that intersects only one nappe of the cone—its slope is shallower than the slope of the cone’s sides. A circle is obtained in the special case that the cutting plane is perpendicular to the cone’s axis.
