#pragma once
#include
#include
namespace internal
{
// local: cone face x^2+y^2-z^2=0(z<=0)
struct cone_face_t final : subface {
};
} // namespace internal
namespace detail
{
template <>
struct hasher {
// Q' = M^{-T}QM^{-1}
// Q = {
// 1, 0, 0, 0
// 0, 1, 0, 0
// 0, 0, -1, 0
// 0, 0, 0, 0
// }
size_t operator()(const internal::cone_face_t& subface) const
{
// build M^{-T}Q directly
Eigen::Matrix4d mat = internal::empty_affine_matrix;
const auto& M_inv_T = subface.world_to_local.matrix();
mat.leftCols<2>() = M_inv_T.topRows<2>().transpose();
mat.col(2) = -M_inv_T.row(2).transpose();
auto res = mat * subface.world_to_local;
return hash_funcs(res.matrix());
}
};
template <>
struct eq_compare {
bool operator()(const internal::cone_face_t& lhs, const internal::cone_face_t& rhs) const
{
return eq_funcs(lhs.local_to_world, rhs.local_to_world);
}
};
} // namespace detail