|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <base/subface.hpp>
|
|
|
|
|
|
|
|
|
|
namespace internal
|
|
|
|
|
{
|
|
|
|
|
// local: a sphere with center at (0, 0, 0) and radius 1
|
|
|
|
|
// u: planar angle from x-axis to z-axis
|
|
|
|
|
// v: polar angle from xz-plane to y-axis
|
|
|
|
|
// EDIT: recap v from [-pi/2, pi/2] to [0, pi]
|
|
|
|
|
struct sphere_face_t final : subface {
|
|
|
|
|
};
|
|
|
|
|
} // namespace internal
|
|
|
|
|
|
|
|
|
|
namespace detail
|
|
|
|
|
{
|
|
|
|
|
// Q' = M^{-T}QM^{-1}
|
|
|
|
|
// Q = {
|
|
|
|
|
// 1, 0, 0, 0
|
|
|
|
|
// 0, 1, 0, 0
|
|
|
|
|
// 0, 0, 1, 0
|
|
|
|
|
// 0, 0, 0, -1
|
|
|
|
|
// }
|
|
|
|
|
const Eigen::Vector4d sphere_std_diag{1, 1, 1, -1};
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
inline size_t hasher<internal::sphere_face_t>::operator()(const internal::sphere_face_t& subface) const
|
|
|
|
|
{
|
|
|
|
|
return hash_funcs(get_quadrics_character(sphere_std_diag, subface));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <>
|
|
|
|
|
inline bool eq_compare<internal::sphere_face_t>::operator()(const internal::sphere_face_t& lhs,
|
|
|
|
|
const internal::sphere_face_t& rhs) const
|
|
|
|
|
{
|
|
|
|
|
return eq_funcs(get_quadrics_character(sphere_std_diag, lhs), get_quadrics_character(sphere_std_diag, rhs));
|
|
|
|
|
}
|
|
|
|
|
} // namespace detail
|