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.
53 lines
3.3 KiB
53 lines
3.3 KiB
2 weeks ago
|
#include <process.hpp>
|
||
|
#include <post_topo.hpp>
|
||
|
|
||
|
void map_chain_to_parameteric_plane(const baked_blobtree_t& tree,
|
||
|
const stl_vector_mp<Eigen::Vector3d>& vertices,
|
||
|
const stl_vector_mp<polygon_face_t>& faces,
|
||
|
const stl_vector_mp<stl_vector_mp<uint32_t>>& patches,
|
||
|
const stl_vector_mp<stl_vector_mp<uint32_t>>& chains,
|
||
|
const flat_hash_map_mp<uint32_t, stl_vector_mp<uint32_t>>& chain_of_patch,
|
||
|
const flat_hash_map_mp<uint32_t, uint32_t>& vertex_old_index_to_unique_index,
|
||
|
const dynamic_bitset_mp<>& chain_end_vertex_signular_flag,
|
||
|
flat_hash_map_mp<uint32_t, parameteric_plane_t>& parameteric_planes)
|
||
|
{
|
||
|
flat_hash_map_mp<uint32_t, stl_vector_mp<uint32_t>> patch_of_subface{};
|
||
|
for (const auto& [patch_index, _] : chain_of_patch) {
|
||
|
const auto& subface_index = faces[patches[patch_index][0]].subface_index;
|
||
|
patch_of_subface[subface_index].emplace_back(patch_index);
|
||
|
}
|
||
|
|
||
|
const auto& subfaces = tree.subfaces;
|
||
|
for (const auto& [subface_index, patch_indices] : patch_of_subface) {
|
||
|
const auto& subface = *subfaces[subface_index].object_ptr;
|
||
|
auto mapping_func = subface.fetch_param_mapping_evaluator();
|
||
|
auto& parameteric_plane = parameteric_planes[subface_index];
|
||
|
auto& chain_vertices = parameteric_plane.chain_vertices;
|
||
|
auto& chain_group_start_indices = parameteric_plane.chain_group_start_indices;
|
||
|
auto& chain_vertex_flags = parameteric_plane.vertex_special_flags;
|
||
|
chain_group_start_indices.reserve(patch_indices.size());
|
||
|
chain_group_start_indices.emplace_back(0);
|
||
|
|
||
|
for (const auto& patch_index : patch_indices) {
|
||
|
const auto& chain_indices = chain_of_patch.at(patch_index);
|
||
|
chain_group_start_indices.emplace_back(chain_indices.size() + chain_group_start_indices.back());
|
||
|
chain_vertices.reserve(chain_vertices.size() + chain_indices.size());
|
||
|
chain_vertex_flags.reserve(chain_vertex_flags.size() + chain_indices.size());
|
||
|
for (const auto& chain_index : chain_indices) {
|
||
|
const auto& chain = chains[chain_index];
|
||
|
|
||
|
auto& chain_vertices_ = chain_vertices.emplace_back();
|
||
|
chain_vertices_.resize(chain.size());
|
||
|
std::transform(chain.begin(), chain.end(), chain_vertices_.begin(), [&](uint32_t vertex_index) {
|
||
|
auto mapped_vertex_index = vertex_old_index_to_unique_index.at(vertex_index);
|
||
|
return mapping_func(vertices[mapped_vertex_index]);
|
||
|
});
|
||
|
|
||
|
auto& chain_vertex_flags_ = chain_vertex_flags.emplace_back();
|
||
|
chain_vertex_flags_.resize(chain.size());
|
||
|
chain_vertex_flags_[0] = chain_end_vertex_signular_flag[2 * chain_index];
|
||
|
chain_vertex_flags_[chain.size() - 1] = chain_end_vertex_signular_flag[2 * chain_index + 1];
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|