|
@ -1,17 +1,17 @@ |
|
|
#include <prim_gen.hpp> |
|
|
#include <prim_gen.hpp> |
|
|
#include <helper.hpp> |
|
|
#include <helper.hpp> |
|
|
#include "fwd_types.hpp" |
|
|
|
|
|
|
|
|
|
|
|
void extract_iso_mesh(const std::array<uint32_t, 3>& tet_active_subface_counts, |
|
|
void extract_iso_mesh(const std::array<uint32_t, 3>& tet_active_subface_counts, |
|
|
const stl_vector_mp<arrangement_t>& tetrahedron_arrangements, |
|
|
const stl_vector_mp<arrangement_t>& tetrahedron_arrangements, |
|
|
const scene_bg_mesh_info_t& scene_bg_mesh_info, |
|
|
const scene_bg_mesh_info_t& scene_bg_mesh_info, |
|
|
const stl_vector_mp<std::array<uint32_t, 4>>& tetrahedrons, |
|
|
const stl_vector_mp<std::array<uint32_t, 4>>& tetrahedrons, |
|
|
const stl_vector_mp<uint32_t>& tetrahedron_active_subface_start_index, |
|
|
const stl_vector_mp<uint32_t>& tetrahedron_active_subface_start_index, |
|
|
const stl_vector_mp<uint32_t>& active_subface_indices, |
|
|
const stl_vector_mp<uint32_t>& active_subface_indices, |
|
|
const flat_hash_map_mp<uint32_t, bg_mesh_vert_info_t>& vertex_infos, |
|
|
const Eigen::MatrixXd& vertex_infos, |
|
|
stl_vector_mp<Eigen::Vector3d>& iso_pts, |
|
|
const flat_hash_map_mp<uint32_t, uint32_t>& vertex_indices_mapping, |
|
|
stl_vector_mp<iso_vertex_t>& iso_verts, |
|
|
stl_vector_mp<Eigen::Vector3d>& iso_pts, |
|
|
stl_vector_mp<polygon_face_t>& iso_faces) |
|
|
stl_vector_mp<iso_vertex_t>& iso_verts, |
|
|
|
|
|
stl_vector_mp<polygon_face_t>& iso_faces) |
|
|
{ |
|
|
{ |
|
|
// estimate number of iso-verts and iso-faces
|
|
|
// estimate number of iso-verts and iso-faces
|
|
|
const auto& [num_1_func, num_2_func, num_more_func] = tet_active_subface_counts; |
|
|
const auto& [num_1_func, num_2_func, num_more_func] = tet_active_subface_counts; |
|
@ -120,8 +120,8 @@ void extract_iso_mesh(const std::array<uint32_t, 3>& tet |
|
|
iso_vert.simplex_vertex_indices = {vId1, vId2}; |
|
|
iso_vert.simplex_vertex_indices = {vId1, vId2}; |
|
|
iso_vert.subface_indices = {implicit_pIds[0]}; |
|
|
iso_vert.subface_indices = {implicit_pIds[0]}; |
|
|
|
|
|
|
|
|
const auto f1 = find_subface_by_index(vertex_infos.at(vId1), implicit_pIds[0])->sdf_value; |
|
|
const auto f1 = vertex_infos(vertex_indices_mapping.at(vId1), implicit_pIds[0]); |
|
|
const auto f2 = find_subface_by_index(vertex_infos.at(vId2), implicit_pIds[0])->sdf_value; |
|
|
const auto f2 = vertex_infos(vertex_indices_mapping.at(vId2), implicit_pIds[0]); |
|
|
const auto coord = compute_barycentric_coords(f1, f2); |
|
|
const auto coord = compute_barycentric_coords(f1, f2); |
|
|
iso_pts.emplace_back(coord[0] * get_vert_pos(vId1, scene_bg_mesh_info) |
|
|
iso_pts.emplace_back(coord[0] * get_vert_pos(vId1, scene_bg_mesh_info) |
|
|
+ coord[1] * get_vert_pos(vId2, scene_bg_mesh_info)); |
|
|
+ coord[1] * get_vert_pos(vId2, scene_bg_mesh_info)); |
|
@ -146,15 +146,16 @@ void extract_iso_mesh(const std::array<uint32_t, 3>& tet |
|
|
iso_vert.subface_indices = {implicit_pIds[0], implicit_pIds[1]}; |
|
|
iso_vert.subface_indices = {implicit_pIds[0], implicit_pIds[1]}; |
|
|
|
|
|
|
|
|
//
|
|
|
//
|
|
|
const auto &vert_face0 = vertex_infos.at(vIds3[0]), vert_face1 = vertex_infos.at(vIds3[1]), |
|
|
const auto &vert_face0 = vertex_infos.row(vertex_indices_mapping.at(vIds3[0])), |
|
|
vert_face2 = vertex_infos.at(vIds3[2]); |
|
|
vert_face1 = vertex_infos.row(vertex_indices_mapping.at(vIds3[1])), |
|
|
const auto f1 = std::array{find_subface_by_index(vert_face0, implicit_pIds[0])->sdf_value, |
|
|
vert_face2 = vertex_infos.row(vertex_indices_mapping.at(vIds3[2])); |
|
|
find_subface_by_index(vert_face1, implicit_pIds[0])->sdf_value, |
|
|
const auto f1 = std::array{vert_face0(implicit_pIds[0]), |
|
|
find_subface_by_index(vert_face2, implicit_pIds[0])->sdf_value}; |
|
|
vert_face1(implicit_pIds[0]), |
|
|
const auto f2 = std::array{find_subface_by_index(vert_face0, implicit_pIds[1])->sdf_value, |
|
|
vert_face2(implicit_pIds[0])}; |
|
|
find_subface_by_index(vert_face1, implicit_pIds[1])->sdf_value, |
|
|
const auto f2 = std::array{vert_face0(implicit_pIds[1]), |
|
|
find_subface_by_index(vert_face2, implicit_pIds[1])->sdf_value}; |
|
|
vert_face1(implicit_pIds[1]), |
|
|
const auto coord = compute_barycentric_coords(f1, f2); |
|
|
vert_face2(implicit_pIds[1])}; |
|
|
|
|
|
const auto coord = compute_barycentric_coords(f1, f2); |
|
|
iso_pts.emplace_back(coord[0] * get_vert_pos(vIds3[0], scene_bg_mesh_info) |
|
|
iso_pts.emplace_back(coord[0] * get_vert_pos(vIds3[0], scene_bg_mesh_info) |
|
|
+ coord[1] * get_vert_pos(vIds3[1], scene_bg_mesh_info) |
|
|
+ coord[1] * get_vert_pos(vIds3[1], scene_bg_mesh_info) |
|
|
+ coord[2] * get_vert_pos(vIds3[2], scene_bg_mesh_info)); |
|
|
+ coord[2] * get_vert_pos(vIds3[2], scene_bg_mesh_info)); |
|
@ -170,22 +171,22 @@ void extract_iso_mesh(const std::array<uint32_t, 3>& tet |
|
|
iso_vert.simplex_vertex_indices = tetrahedrons[i]; |
|
|
iso_vert.simplex_vertex_indices = tetrahedrons[i]; |
|
|
iso_vert.subface_indices = implicit_pIds; |
|
|
iso_vert.subface_indices = implicit_pIds; |
|
|
|
|
|
|
|
|
const auto &vert_face0 = vertex_infos.at(tetrahedrons[i][0]), |
|
|
const auto &vert_face0 = vertex_infos.row(vertex_indices_mapping.at(tetrahedrons[i][0])), |
|
|
vert_face1 = vertex_infos.at(tetrahedrons[i][1]), |
|
|
vert_face1 = vertex_infos.row(vertex_indices_mapping.at(tetrahedrons[i][1])), |
|
|
vert_face2 = vertex_infos.at(tetrahedrons[i][2]), |
|
|
vert_face2 = vertex_infos.row(vertex_indices_mapping.at(tetrahedrons[i][2])), |
|
|
vert_face3 = vertex_infos.at(tetrahedrons[i][3]); |
|
|
vert_face3 = vertex_infos.row(vertex_indices_mapping.at(tetrahedrons[i][3])); |
|
|
const auto f1 = std::array{find_subface_by_index(vert_face0, implicit_pIds[0])->sdf_value, |
|
|
const auto f1 = std::array{vert_face0(implicit_pIds[0]), |
|
|
find_subface_by_index(vert_face1, implicit_pIds[0])->sdf_value, |
|
|
vert_face1(implicit_pIds[0]), |
|
|
find_subface_by_index(vert_face2, implicit_pIds[0])->sdf_value, |
|
|
vert_face2(implicit_pIds[0]), |
|
|
find_subface_by_index(vert_face3, implicit_pIds[0])->sdf_value}; |
|
|
vert_face3(implicit_pIds[0])}; |
|
|
const auto f2 = std::array{find_subface_by_index(vert_face0, implicit_pIds[1])->sdf_value, |
|
|
const auto f2 = std::array{vert_face0(implicit_pIds[1]), |
|
|
find_subface_by_index(vert_face1, implicit_pIds[1])->sdf_value, |
|
|
vert_face1(implicit_pIds[1]), |
|
|
find_subface_by_index(vert_face2, implicit_pIds[1])->sdf_value, |
|
|
vert_face2(implicit_pIds[1]), |
|
|
find_subface_by_index(vert_face3, implicit_pIds[1])->sdf_value}; |
|
|
vert_face3(implicit_pIds[1])}; |
|
|
const auto f3 = std::array{find_subface_by_index(vert_face0, implicit_pIds[2])->sdf_value, |
|
|
const auto f3 = std::array{vert_face0(implicit_pIds[2]), |
|
|
find_subface_by_index(vert_face1, implicit_pIds[2])->sdf_value, |
|
|
vert_face1(implicit_pIds[2]), |
|
|
find_subface_by_index(vert_face2, implicit_pIds[2])->sdf_value, |
|
|
vert_face2(implicit_pIds[2]), |
|
|
find_subface_by_index(vert_face3, implicit_pIds[2])->sdf_value}; |
|
|
vert_face3(implicit_pIds[2])}; |
|
|
const auto coord = compute_barycentric_coords(f1, f2, f3); |
|
|
const auto coord = compute_barycentric_coords(f1, f2, f3); |
|
|
iso_pts.emplace_back(coord[0] * get_vert_pos(tetrahedrons[i][0], scene_bg_mesh_info) |
|
|
iso_pts.emplace_back(coord[0] * get_vert_pos(tetrahedrons[i][0], scene_bg_mesh_info) |
|
|
+ coord[1] * get_vert_pos(tetrahedrons[i][1], scene_bg_mesh_info) |
|
|
+ coord[1] * get_vert_pos(tetrahedrons[i][1], scene_bg_mesh_info) |
|
|