#pragma once
#include
namespace internal
{
// local: cylinder face x^2+y^2-1=0
// u: planar angle from x-axis to z-axis
// v: depth/height from xz-plane to y-axis
struct cylinder_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, 0, 0
// 0, 0, 0, -1
// }
size_t operator()(const internal::cylinder_face_t& subface) const
{
// build M^{-T}Q directly
Eigen::Matrix4d mat = internal::empty_affine_matrix;
mat.leftCols<2>() = subface.world_to_local.matrix().topRows<2>().transpose();
auto res = mat * subface.world_to_local;
return hash_funcs(res.matrix());
}
// size_t operator()(const internal::cylinder_face_t& subface) const
// {
// auto R = subface.world_to_local.linear().topLeftCorner<2, 3>(); // 2x3
// auto b = subface.local_to_world.translation(); // 3x1
// Eigen::Matrix hash_mat = Eigen::Matrix::Zero();
// hash_mat.topLeftCorner<3, 3>() = R.transpose() * R;
// hash_mat.topRightCorner<2, 1>() = R * b;
// return hash_funcs(hash_mat);
// }
};
} // namespace detail