Prompt

In this reference frame, the spaceship is oriented at [0, 0, 1] relative to the spacecraft. In the reference frame of J2000 the spaceship is oriented at [0.14129425, -0.98905974, 0.04238827]. Find the spacecraft attitude quaternion.

Background

In mathematics, a quaternion is an extended complex number which helpes to represent mechanics, orientation, rotation, and movement in 3 dimensions. They are often used in computer graphics, computer vision, and applied mathematics and represented in the form a + bi + cj + dk. In that form a, b, c, and d are real numbers and i, j, and k are the basic quaternions.

To learn more about quaternions

https://en.wikipedia.org/wiki/Quaternion

https://math.ucr.edu/~huerta/introquaternions.pdf

https://youtu.be/d4EgbgTm0Bg

Solution

Looking up how to convert two vectors into a quaternion we come across the set of equations

A, B are the given vectors
The form of the answer will be q = (w, x, y, z) <-- NOTE the order

$$N = \frac{A\times B}{||A\times B||}$$

$$\Theta= \arctan{\frac{||A\times B||}{A\cdot B}}$$

$$q = [\cos(\frac{\Theta}{2}), \vec{N}\sin(\frac{\Theta}{2})]$$

So for our solution, A is [0, 0, 1] and B is [0.14129425, -0.98905974, 0.04238827]. First we find N and then Theta and then plug into the equation for q. Once we do that, we input the values into the netcat connection (during the competition) and…

QED