I want to convert a 2nd degree rational Bézier curve in 3 dimensions (4 if in homogeneous coordinates) into a conic parametric curve.
Given a rational bezier curve of degree 2: $$B(t) = \frac{(1-t)^2 P_0 w_0 + 2 t (1 - t) P_1 w_1 + t^2 P_2 w_2}{(1-t)^2 w_0 + 2 t (1 - t) w_1 + t^2 w_2}, P_i \in \mathbb{R}^3, w_i \in \mathbb{R} $$
I want to convert this to an equal curve of the form
$E(s) = C_E + f_1 cos(s) + f_2 sin(s)$ if it is an ellipse, or
$H(s) = C_H + f_1 cosh(s) + f_2 sinh(s) $ if it is a hyperbola
Alternative form: $B(t) = \frac{t^2A+tB+C}{t^2w_A+tw_B+w_C}$, with
$A = P_0 w_0 - 2 P_1 w_1 + P_2 w_2$
$B = 2 P_1 w_1 - 2 P_0 w_0$
$C = P_0 w_0$
I have a partial solution for the ellipse case:
I'm not exactly sure why, but it seems that at the point $t_0$ where the weight term $t^2w_A+tw_B+w_C$ has its extrema ($2 t_0 w_A + w_B = 0 \Rightarrow t_0 = -w_B / 2 / w_A$), the segment from $B(t_0)$ to $B(\infty) = A / w_A$ crosses the center of the ellipse. Hence we get the center of the ellipse:
$C_E = \frac{1}{2}(B(t_0) + B(\infty))$
for $f_1$ we can choose the vector from the center to $B(\infty)$
$f_1 = \frac{1}{2}(B(\infty) - B(t_0)) = \frac{1}{2}(\frac{A}{w_A} - \frac{C}{w_C})$
To get $f_2$ we can use the fact that $E(\pi/2) = C_E + f_2$ and $E'(\pi/2) = f_1$. (I.e. the point at which the tangent of the ellipse is parallel to $f_1$ is equal to $C_E + f_2$). As B and E have different parameters, the derivates are different, however the derivates in the same point are parallel. I.e. we need to figure out for which $t_1$ $B'(t_1) = u f_1, u \in \mathbb{R}$ (For simplification I am assuming that $t_0 = 0$ in the following equations. If it is not, an equal Bézier with $t_0$ shifted to $0$ can be obtained by expanding $B(t + t_0)$)
$$B'(t) = \frac{t^2 (A w_B - B w_A) + 2t(A w_C-Cw_A)+(Bw_C-Cw_B)}{(t^2 w_A + t w_B + w_C)^2} = u f_1$$
As the denominator is a simple scalar, it does not change the direction of the vector and can be ignored in this case. The 1/2 scalar in $f_1$'s definition can also be ignored:
$$t^2 (A w_B - B w_A) + 2t(A w_C-Cw_A)+(Bw_C-Cw_B) = u (Aw_C - Cw_A)$$
Subtracting $2t(A w_C-Cw_A)$ from both sides does not change the direction either:
$$t^2 (A w_B - B w_A) +(Bw_C-Cw_B) = u (Aw_C - Cw_A))$$
The above equation is satisfied with $t_1 = \sqrt{w_C /w_A}$ and we can calculate:
$f_2 = B(t_1) - C_E$
I have two issues with the above solution: a) it breaks down when the weights are chosen such that $w_A = 0$, as $t_0$ is undefined. b) While the steps for the center and $f_1$ work analogously in the case of a hyperbola, I have not been able to figure out a similar condition to calculate $f_2$.
This answer for a similar question suggests converting the rational bezier into a matrix conic form, however I'm not sure this works in 3D?