Largest circle between lines through point Calculate circle through a point, with its center on a line
I am trying to make a program in java that calculates the largest circle between two tangential lines through a point that is not on one of the lines. 

I have the coordinates of A, B, C and D (the point where the circle goes through), the angle between AB and AC and I already know how to get the bisector. If I could calculate the centers of both circles, I could calculate their radii, so I know which circle is the biggest.
So my question is: How can I get the coordinates of the center of both circles?
 A: This can be solved using right triangle trigonometry and a quadratic equation.
I have taken the liberty to relabel your angle $x$ as angle $\alpha$. There are only two circles passing through point $D$ and tangent to the two lines, and you want the larger of the two. When we get to the solution of the quadratic equation, this will amount to taking the 'plus' option of the 'plus or minus' in the solution.

To specify the largest circle containing $D$ we need to know the distance $h$ of $E$ from $A$ and the radius $r=ED=EG$ of the circle. For these two unknown quantities, we have readily available two equations.
From $\triangle AGE$ we have
$$ r=h\sin\alpha \tag{1}$$
From the equation of a circle we have
$$ r^2=(x-h)^2+y^2\tag{2} $$
Combining the two gives
$$h^2\sin^2\alpha=(x-h)^2+y^2$$
which can be re-arranged (using the identity $1-\sin^2\alpha=\cos^2\alpha$) into a quadratic equation in $h$:
$$ \left(\cos^2\alpha\right)h^2-2xh+\left(x^2+y^2\right)=0 $$
Using the quadratic formula and a bit of trigonometric simplification
$$ h=\frac{x+\sqrt{x^2\sin^2\alpha-y^2\cos^2\alpha}}{\cos^2\alpha} \tag{3}$$
This value may be substituted into equation (1) to find $r$.
Here is a link to a Geogebra Applet using the equations for $h$ and $r$ given above. You can change the angle $\alpha$ by moving the point $B$ and you can also move the point $D$.
A: Suppose that the given lines make an angle of $2\theta$ at their intersection, $O$, and that the given point, $P$, is such that $\overline{OP}$ makes an angle of $\phi$ with the angle bisector. (We'll assume $-\theta \leq \phi \leq \theta$.) Define $p := |OP|$. Let the circles be tangent to one of the lines at $S$ and $T$, and let $M$ be the midpoint of $\overline{ST}$. Let $P^\prime$ and $M^\prime$ be the reflections of $P$ and $M$ in the bisector. Finally, let $R$ and $R^\prime$ be the feet of perpendiculars from $P$ to the lines, as shown.
Note that $\overleftrightarrow{PP^\prime}$ is the radical axis of the two circles, which necessarily passes through $M$ and $M^\prime$. 

Now, by simple trigonometry,
$$|OM| = |OM^\prime| = |ON|\sec\theta = |OP| \cos\phi\sec\theta = p\cos\phi\sec\theta \tag{1}$$
Also,
$$\begin{align}
|MP\phantom{^\prime}|\phantom{=|PM^\prime|}\; &= |PR\phantom{^\prime}|\sec\theta = |OP|\sin(\theta+\phi)\sec\theta = p\sin(\theta+\phi)\sec\theta \\
|MP^\prime| = |PM^\prime| &= |PR^\prime|\sec\theta = |OP|\sin(\theta-\phi)\sec\theta = p\sin(\theta-\phi)\sec\theta
\end{align} \tag{2}$$
By the power of a point theorems, we can express the power of $M$ with respect to the "bigger" circle in two ways:
$$|MT|^2 = |MP||MP^\prime| \quad\to\quad |MT|=p\sec\theta\;\sqrt{\sin(\theta+\phi)\sin(\theta-\phi)} \tag{3}$$
We see, then, that tangent point $T$ is the point on the line such that
$$|OT|= |OM|+|MT| = p\sec\theta\left(\;\cos\phi + \sqrt{\sin(\theta+\phi)\sin(\theta-\phi)}\;\right) \tag{4}$$
Finally, the perpendicular at $T$ meets the angle bisector at $T_\star$, the center of the bigger circle, and we have

$$\begin{align}
|OT_\star| &= |OT|\sec\theta = p \sec^2\theta\;\left(\;\cos\phi + \sqrt{\sin(\theta+\phi)\sin(\theta-\phi)}\;\right) \\
|TT_\star| &= |OT|\tan\theta = p \sec\theta\tan\theta \;\left(\;\cos\phi + \sqrt{\sin(\theta+\phi)\sin(\theta-\phi)}\;\right)
\end{align} \tag{$\star$}$$

giving the location of the center, and the radius, of the bigger circle. $\square$

Observe that the various trig values are all readily calculated via vector methods.
Write $u$ and $v$ for unit direction vectors of the lines, and $w$ for the unit direction vector of the bisector (ie, $w=(u+v)/|u+v|$). And let $q$ be the vector $\overrightarrow{OP}$ (I want to call it $p$, but that's in use for the length of that vector); if we distribute $p$ across the expressions in $(\star)$, we don't have to bother "unitizing" $q$.
$$p\cos\phi + \sqrt{p\sin(\theta+\phi)\,p\sin(\theta-\phi)} = q\cdot w + \sqrt{|u\times q|\,|q\times v|}$$
$$\sec^2\theta = \frac1{\cos^2\theta} = \frac{1}{(u\cdot w)^2} \qquad
\sec\theta\tan\theta = \frac{\sin\theta}{\cos^2\theta} = \frac{|u\times w|}{(u\cdot w)^2}$$
A: Let $a=\tan x$ be the slope of line $AB$. Let $G=(G_x,G_y)$ be the point of contact between the larger circle and the line $AB$ (so that $G_y=aG_x$). Then $E=(E_x,0)$, where $E_x=aG_y+G_x$ (because $GE$ is perpendicular to $AB$, so its slope is $-1/a$).
We have $|GE|^2=|DE|^2$, so
$$(E_x-G_x)^2+(E_y-G_y)^2=(E_x-D_x)^2+(E_y-D_y)^2$$
$$(aG_y)^2+G_y^2=((aG_y+G_x)-D_x)^2+D_y^2$$
$$(a^2+1)G_y^2=((a^2+1)G_x-D_x)^2+D_y^2$$
$$(a^2+1)a^2G_x^2=((a^2+1)G_x-D_x)^2+D_y^2$$
The quantities $a,D_x,$ and $D_y$ are all known, so this is just a quadratic equation in $G_x$. Solve it, and take the larger of the two solutions. This will give you immediately $G_y=aG_x$ and $E_x=aG_y+G_x$.
