You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
#pragma once
|
|
|
|
#include <base/subface.hpp>
|
|
|
|
namespace internal
|
|
{
|
|
// local: plane x=0
|
|
// u: planar local x-axis
|
|
// v: planar local y-axis
|
|
struct plane_t final : subface {
|
|
};
|
|
} // namespace internal
|
|
|
|
namespace detail
|
|
{
|
|
inline auto get_plane_character(const internal::plane_t& subface)
|
|
{
|
|
// CAUTION: we use vec4d to contain translation info here
|
|
// to do this, we have to use the first row of world_to_local instead of the first column of local_to_world
|
|
// since the later one does not contain translation info
|
|
Eigen::Vector4d vec = subface.world_to_local.matrix().row(0);
|
|
auto norm = vec.head<3>().norm();
|
|
vec /= norm;
|
|
return vec;
|
|
}
|
|
|
|
template <>
|
|
inline size_t hasher<internal::plane_t>::operator()(const internal::plane_t& subface) const
|
|
{
|
|
return hash_funcs(get_plane_character(subface));
|
|
}
|
|
|
|
template <>
|
|
inline bool eq_compare<internal::plane_t>::operator()(const internal::plane_t& lhs, const internal::plane_t& rhs) const
|
|
{
|
|
return eq_funcs(get_plane_character(lhs), get_plane_character(rhs));
|
|
}
|
|
} // namespace detail
|