extract explicit mesh with topology information from implicit surfaces with boolean operations, and do surface/volume integrating on them.
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.
 
 
 
 
 
 

43 lines
1.1 KiB

#pragma once
#include <base/subface.hpp>
#include <primitive_descriptor.h>
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<internal::cone_face_t> {
// 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<internal::cone_face_t> {
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