#pragma once
#include
#include
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 {
const sphere_descriptor_t* geometry_ptr = nullptr;
const sphere_descriptor_t* get_geometry_ptr() const
{
printf("[WARNING] sphere_face_t::descriptor() called, but sphere has no descriptor!\n");
return nullptr;
}
};
} // namespace internal
namespace detail
{
template <>
struct hasher {
size_t operator()(const internal::sphere_face_t& subface) const { return hash_funcs(subface.local_to_world); }
};
template <>
struct eq_compare {
bool operator()(const internal::sphere_face_t& lhs, const internal::sphere_face_t& rhs) const
{
//return eq_funcs(lhs.local_to_world, rhs.local_to_world);
constexpr double eps = 1e-12;
bool matrix_eq = lhs.world_to_local.isApprox(rhs.world_to_local, eps);
return matrix_eq;
}
};
} // namespace detail