...one of the most highly
regarded and expertly designed C++ library projects in the
world. — Herb Sutter and Andrei
template<typename T> octonion<T> spherical(T const & rho, T const & theta, T const & phi1, T const & phi2, T const & phi3, T const & phi4, T const & phi5, T const & phi6); template<typename T> octonion<T> multipolar(T const & rho1, T const & theta1, T const & rho2, T const & theta2, T const & rho3, T const & theta3, T const & rho4, T const & theta4); template<typename T> octonion<T> cylindrical(T const & r, T const & angle, T const & h1, T const & h2, T const & h3, T const & h4, T const & h5, T const & h6);
These build octonions in a way similar to the way polar builds complex numbers, as there is no strict equivalent to polar coordinates for octonions.
spherical is a simple transposition
polar, it takes as inputs
a (positive) magnitude and a point on the hypersphere, given by three angles.
The first of these, theta has a natural range of -pi to
+pi, and the other two have natural ranges of -pi/2 to +pi/2 (as is the case
with the usual spherical coordinates in R3).
Due to the many symmetries and periodicities, nothing untoward happens if the
magnitude is negative or the angles are outside their natural ranges. The expected
degeneracies (a magnitude of zero ignores the angles settings...) do happen
cylindrical is likewise a simple
transposition of the usual cylindrical coordinates in R3,
which in turn is another derivative of planar polar coordinates. The first
two inputs are the polar coordinates of the first C
component of the octonion. The third and fourth inputs are placed into the
third and fourth R components
of the octonion, respectively.
multipolar is yet another simple
generalization of polar coordinates. This time, both C
components of the octonion are given in polar coordinates.
In this version of our implementation of octonions, there is no analogue of the complex value operation arg as the situation is somewhat more complicated.