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.

46 lines
2.0 KiB

#pragma once
#include <base/subface.hpp>
namespace internal
{
// local: cylinder face x^2+y^2-1=0
struct cylinder_face_t final : subface {
static constexpr uint64_t max_degree = 2;
static constexpr equation_system_type eq_sys_type = equation_system_type::implicit;
std::function<double(Eigen::Vector3d)> fetch_sdf_evaluator() const override;
std::function<Eigen::Vector3d(Eigen::Vector3d)> fetch_sdf_grad_evaluator() const override;
// u: planar angle from x-axis to z-axis
// v: depth/height from xz-plane to y-axis
std::function<Eigen::Vector4d(double, double)> fetch_point_by_param_evaluator() const override;
std::function<Eigen::Vector2d(Eigen::Vector3d)> fetch_param_mapping_evaluator() const override;
std::function<constraint_curve_intermediate(double)> fetch_curve_constraint_evaluator(parameter_u_t constraint_var_type,
double u) const override;
std::function<constraint_curve_intermediate(double)> fetch_curve_constraint_evaluator(parameter_v_t constraint_var_type,
double v) const override;
std::function<equation_intermediate_t(constraint_curve_intermediate &&)> fetch_solver_evaluator() const override;
};
} // namespace internal
namespace detail
{
struct cylinder_surface_tag{};
template <>
struct tagged_hasher<internal::paired_model_matrix_ptr_t, cylinder_surface_tag> {
size_t operator()(const internal::paired_model_matrix& block) const
{
auto R = block.world_to_local.linear().topLeftCorner<2, 3>(); // 2x3
auto b = block.local_to_world.translation(); // 3x1
1 week ago
Eigen::Matrix<double, 3, 4> hash_mat = Eigen::Matrix<double, 3, 4>::Zero();
hash_mat.topLeftCorner<3, 3>() = R.transpose() * R;
hash_mat.topRightCorner<2, 1>() = R * b;
return hash_funcs(hash_mat);
}
};
} // namespace detail