Connecting two 3D functions with a curve Let’s say I have a helix as so$$f(t)=2\sin t\text{i}+2\cos t\text{j}+\frac t2\text{k}\qquad 0\leq t\leq8\pi$$
The end point is $P(0,2,4\pi)$. I want to be able to connect the end of the helix with a horizontal tangent line but also keep the curve smooth.
As of right now, if we differentiate $f(t)$ and substitute $t=8\pi$ to get the direction vector, the line is angled (i.e not completely horizontal).
My plan is to insert an arc whose tangent line is also tangent to the end of the helix and ends with a horizontal tangent.

Question: Is there a way to algebraically determine the equation of a circle or arc that connects the end of the helix with a horizontal line?

 A: Here is a geometric approach. With the data you provided, the horizontal line and the tangent to the curve at the end point are both in the $y=2$ plane. I will use the distance from the end point to the horizontal line as $d$, where $d=14-4\pi$. To link $P$ to the horizontal line with an arc, tangent to both the horizontal line and the helix, we draw a perpendicular to the tangent at $P$. On this line we can choose a point $C$, and $CP$ will be perpendicular to the helix at point $P$. Draw the perpendicular to the horizontal line from $C$, and you will obtain point $D$. Now the only requirement left to satisfy is $CP=CD$. 
The tangent vector to the helix makes an angle $\alpha$ with the horizontal (you can get $\cos\alpha$ from the scalar product). 
Case 1: assume $C$ is lower than $P$. Project $P$ onto $CD$ to get $P'$. Then $$CP'=PC\cos\alpha=R\cos\alpha=CD-P'D=R-d$$
This yields $$R=\frac d{1-\cos\alpha}$$
Case 2: assume $C$ is higher than $P$. With a similar approach to the first case, you get $$R=\frac d{1+\cos\alpha}$$
Now, to find the center of the circle, in case 1 you get $C=P+(R\sin\alpha,0,-R\cos\alpha)$, and in case 2 you have $C=P+(-R\sin\alpha,0,R\cos\alpha)$. From here, you can write the equation of the arc as $$A=C+R(-\sin u,0,\cos u)$$
In the first case $u$ varies from $\alpha$ to $0$ (decreasing). In the second case you will just need to change some signs. 
You can approach this problem in an analytical geometry way as well. Assume that you have an arc linking the horizontal line and $P$. Write the equation of the arc, then find $R$ and $C$ using $(P-C)^2=R^2$ and the condition that the tangent to the arc at $P$ and the tangent to the helix at $P$ are parallel, and the tangent at intersection with the horizontal line is along the given horizontal line.
A: We have 
$$ x_0 = x_1 = 0, x'_0 = x'_1 = 2 $$
$$ y_0 = y_1 = 2, y'_0 = y'_1 = 0 $$
$$ z_0 = 4\pi, z_1 = 14, z'_0 = \frac{1}{2}, z'_1 = 0 $$
When you have the values and derivatives at the endpoints of an interval, a cubic Hermite spline is the customary solution:
$$ x(u) = 4u^3 - 6u^2 + 2u $$
$$ y(u) = 2 $$
$$ z(u) = (8\pi-\frac{55}{2})u^3 + (41-12\pi)u^2 + \frac{1}{2}u + 4\pi $$
for 0≤u≤1.
If you use a quintic matching the second derivatives too, the joins will look smoother to the eye; add to each of the functions above the appropriate multiples of $t^2(1-t)^3$ and $t^3(1-t)^2$.
A: A circle (and an arc of it) lies on a plane.
The plane will contain all the points and the tangent lines to the circle (arc), and its center.   
Therefore you cannot use a circular arc, or any plane curve, if the tangent to the helix and the horizontal line are not incident.
Supposing they are, find the incidence point (call it $P$).
Take two unitary vectors $\bf u, \bf v$, on each line, with the appropriate orientation, e.g. from $P$ to helix end, and from $P$ in the direction along the horizontal line in which a hypothetical point exiting the helix shall continue to move.
With these choice, $P, \bf u, \bf v$ determine the plane containing the circle, and $\bf w = \bf u + \bf v$ the bisecting line, thus the line containing the center $C$, and pointing in the direction $P \to C$.
Now on the line determined by $\bf w$ and passing through $P$, take a point at a chosen distance $r$ from one line (and thus from both).
