Quaternion Binningο
Quaternion Binning can be used to discretize directions. This can be interpreted as discretizing the surface of a sphere. In general, it is impossible to discretize the sphere with n points such that all points are evenly spaced for an arbitrary n. There must be a mapping between directions and unique indices to store and retrieve direction-dependent data.
Hector_math implements three modes: Spherical, Largest dim and Spherical Fibonacci. They differ in how evenly they discretize the sphere surface and how fast they compute the mapping from a direction to its index.
Mode |
Speed |
Evenly Discretization |
---|---|---|
Spherical |
π‘ |
β |
Largest Dimension |
β |
π‘ |
Spherical Fibonacci |
β |
β |
Sphericalο
The Spherical mode uses polar coordinates to compute \(\theta\) and \(\phi\).
Both angles are evenly discretized. The discretization can be computed medium fast however it is not evenly. There are more bins at the poles and less at the equator.
Largest Dimο
The Largest Dim Mode starts by evaluating which of the \(x\)-, \(y\)- or \(z\)-component of the quaternion is the largest. Then it stores discretized representations of the two remaining components. Lastly, it discretices the \(w\) component of the quaternion.
The largest dimension mode is somewhat faster and doesnβt have a reduced resolution at the poles due to the equidistant angles used in spherical but at the cost of overlapping regions with increased bin resolution. Therefore the bin distribution is much higher in some areas of the sphere surface than in others.
Spherical Fibonacciο
Spherical Fibonacci point sets yield nearly uniform point distributions on the unit sphere. The forward generation of these point sets has been widely researched and is easy to implement, such that they have been used in various applications. The Fibonacci latticeβs points are arranged in a tightly wound generative spiral, each fitting into the smallest gap between the previous points. Because the consecutive points are so far apart, the spiral is normally not visible. The points are evenly spaced in a very isotropic way. Compared to the other modes implemented here, it is the slowest but achieves the best discretization accuracy. For more details on how to compute the spherical fibonacci mapping see Spherical Fibonacci Mapping.
APIο
-
enum hector_math::quaternion_binning_modes::QuaternionBinningModeο
You can visualize the different binning modes using visualize_binning.py LargestDim is somewhat faster and doesnβt have a reduced resolution at the poles due to the equidistant angles used in spherical but at the cost of overlapping regions with increased bin resolution
Values:
-
enumerator LargestDimο
-
enumerator Sphericalο
-
enumerator SphericalFibonacciο
-
enumerator LargestDimο
-
template<typename Scalar, int AXIS_BINS, int ANGLE_BINS, QuaternionBinningMode mode, typename ReturnType = typename detail::QuaternionBinType<AXIS_BINS, ANGLE_BINS>::BinType>
ReturnType hector_math::computeBin(const Eigen::Quaternion<Scalar> &q)ο Computes the bin for the given quaternion. Close quaternions should land in the same bin.
- Template Parameters:
AXIS_BINS β
ANGLE_BINS β
mode β
Scalar β
ReturnType β
- Parameters:
q β
- Returns: