Given a parametric cublic spline in 3D $\vec{S}(t)$ and the position of an object $\vec{P}$ both in earth-centered, earth-fixed cartesian coordinates (ECEF), I would like to find the intersections of a rotated ellipsoid around the object (around its center of gravity). The ellipsoid is supposed to be rotated s.t. its axis match the axis of the body-fixed coordinate system called k.
My approach is: To find the intersections, the general ellipsoid equation must be solved
$$ \dfrac{x^2}{a^2} + \dfrac{y^2}{b^2} + \dfrac{z^2}{c^2} -1 = 0 $$
where a, b and c denote the semiaxis lenghts. Given the 3D spline and 3D position, to find the intersections
$$\vec{S}(t) - \vec{P}$$
is applied s.t. x, y and z become:
$$ x_{ECEF}(t) = a_x + b_x \, t + c_x \, t^2 + d_x \, t^3 - P_x $$ $$ y_{ECEF}(t) = a_y + b_y \, t + c_y \, t^2 + d_y \, t^3 - P_y $$ $$ z_{ECEF}(t) = a_z + b_z \, t + c_z \, t^2 + d_z \, t^3 - P_z $$
All the coefficients a,b,c,d and position vector entries are known. In order to rotate the ellipsoid, the two required rorational matrices are: $\underline{R}_{g, ECEF}$ to rotate from ECEF coordiantes to a local (body fixed) north east down (NED) coordinate system and $\underline{R}_{k, g}$ to rotate from this local coordinate system g to the required coordinate system k. All entries of these matrices are known.
The rotations are then performed by multiplying the matrices with the vector containing x,y and z:
$$ \begin{pmatrix} x(t) \\ y(t) \\ z(t) \\ \end{pmatrix}_k = \underline{R}_{k, g} \, \underline{R}_{g, ECEF} \, \begin{pmatrix} x(t) \\ y(t) \\ z(t) \\ \end{pmatrix}_{ECEF} $$
All I did from now on was to simply plug $x_k(t)$, $y_k(t)$, $z_k(t)$ into the ellipsoid equation
$$ \dfrac{x_k(t)^2}{a^2} + \dfrac{y_k(t)^2}{b^2} + \dfrac{z_k(t)^2}{c^2} -1 = 0 $$
and to solve this numerically for $t$, which is not an issue.
I am unsure, if my approach is correct in general and I'm especially unsure about the coordinate system transformations.
- Is it true that the ellipsoid will be aligned with the k-coordinate system when I apply the transformation as shown above?
- Is the order of rotations apllied correct? Applying all the rotations the other way around (from k to g to ECEF) also works in the bigger context of code I'm using this in which confuses me quite a bit.
- Can the resulting $t$ be simply plugged in to $\vec{S}(t)$ in order to find the corresponding intersection in ECEF coordinates ($\vec{S}(t)$ is defined in ECEF coordinates)?
I don't understand all of your formulation. Anyway, I suggest that you counter-rotate the control points of your cubic instead of rotating the ellipsoid. If the ellipsoid is not centered at the origin, you can also translate to make it so. You can also rescale the coordinates to get a sphere.
Then plug the parametric equation of the cubic into the implicit equation of the unit sphere. Now you need to solve
$$(\mathbf a+\mathbf bt+\mathbf ct^2+\mathbf dt^3)^2=1$$ which is a sextic equation in $t$. It "suffices" to solve for $t$.