So I have two colliding bodies, body A (radius 40) and body B (radius 10). I'm determining if the bodies will merge or deflect by using tangents to the velocity vector of the colliding body (assuming body A is stationary). If all the tangents intersect body A then the objects will merge.
To visualise this, I'm using desmos (my graphs here). Note: Body A is red and Body B is green in desmos.
So far i've managed to create a tangent parallel to the velocity vector using the equation:
$y=\left(c_y+c_r\sin\left(1.5708+\theta_c\right)\right)-\left(\tan\left(\theta_c\right)\left(c_x+c_r\cos\left(1.5708+\theta_c\right)\right)+c_y-\tan\left(\theta_c\right)c_x\right)$
Where $\theta_c$ is the angle of the velocity vector, $c_y$ is the $y$ co-ordinate of Body B, $c_x$ is the $x$ co-ordinate of Body B and $c_r$ is the radius of Body B.
The velocity vector is given by: $y=\tan\left(\theta_c\right)x+c_y-\tan\left(\theta_c\right)c_x$
The problem here is that when i change the angle, the tangent is no longer tangent to Body B and although is still parallel to the velocity vector, it moves in a way I don't intend. I believe with my limited mathematical knowledge that using $tan$ is probably not the best way to go about this and that I should rather use $sin$ and $cos$ in place of $tan$.
Any educated advice would be very helpful as I'm excited to finish the project I'm working on as soon as a I can.
First note, what you have called velocity vector is really a line, not a vector. All you need from that equation is the slope, which is just $\tan(\theta_c)$. If you wanted to give a vector, you could use $$ \vec v = \langle v_x, v_y\rangle = \langle \cos(\theta_c), \sin(\theta_c)\rangle $$
Now your tangent has the right slope, but it doesn't pass through the point as intended. This means the problem is not your using $\tan$ at all, but that you are not using the correct values in your equation of the tangent. The equation of a line of slope $m$ through point $(x_0, y_0)$ is $$ \frac{y-y_0}{x-x_0} = m \;\; \Leftrightarrow \;\; y = y_0 + m(x - x_0) $$ All you have to do is put $m = \tan(\theta_c)$, $y_0 = c_y+c_r\sin\left(1.5708+\theta_c\right)$ and $x_0 = c_x+c_r\cos\left(1.5708+\theta_c\right)$. Theoretically, for some angles $\tan(\theta_c)$ is undefined, so if that's a problem on your graph, you would be better off using $\sin$ and $\cos$ in a proper direction vector instead of slope, but then you have to input the equation of the tangent not as a Cartesian, $y = mx + b$, but as parametric: $(x,y) = (x_0 + v_xt, y_0 + v_yt)$; I'm not personally too familiar with Desmos, but I'm sure it has a way of doing that.
Note also that what you typed in the question as your tangent is not what you meant, because there's no $x$ variable in it at all.
Personally, I don't get why your velocity vector is what it is, or why your condition for merging is what it is, but I guess that's the physics of your project, so it's not what you were asking about.