| 
						
						
							
								
							
						
						
					 | 
					@ -2,6 +2,10 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					#include <post_topo.hpp> | 
					 | 
					 | 
					#include <post_topo.hpp> | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					struct chain_end_vertex_header { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    uint8_t neighbor_chain_count{}; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					}; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					// ===========================================================================================================
 | 
					 | 
					 | 
					// ===========================================================================================================
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					void collect_active_prims(const flat_index_group&        patches, | 
					 | 
					 | 
					void collect_active_prims(const flat_index_group&        patches, | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -44,7 +48,8 @@ void collect_active_prims(const flat_index_group&        patches, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					void transfer_active_prims(const stl_vector_mp<polygon_face_t>& faces, | 
					 | 
					 | 
					void transfer_active_prims(const baked_blobtree_t&              tree, | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                           const stl_vector_mp<polygon_face_t>& faces, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                           const flat_index_group&              patches, | 
					 | 
					 | 
					                           const flat_index_group&              patches, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                           const flat_index_group&              chain_of_patch, | 
					 | 
					 | 
					                           const flat_index_group&              chain_of_patch, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                           const dynamic_bitset_mp<>&           active_patch_label, | 
					 | 
					 | 
					                           const dynamic_bitset_mp<>&           active_patch_label, | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -53,9 +58,17 @@ void transfer_active_prims(const stl_vector_mp<polygon_face_t>& faces, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                           stl_vector_mp<uint32_t>&             output_vertex_counts_of_face, | 
					 | 
					 | 
					                           stl_vector_mp<uint32_t>&             output_vertex_counts_of_face, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                           stl_vector_mp<parametric_plane>&     output_parametric_planes) | 
					 | 
					 | 
					                           stl_vector_mp<parametric_plane>&     output_parametric_planes) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{ | 
					 | 
					 | 
					{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    flat_hash_map_mp<uint32_t, chain_end_vertex_header> chain_end_vertex_headers{}; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    const auto&                                         subfaces = tree.subfaces; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    output_polygon_faces.reserve(faces.size()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    output_vertex_counts_of_face.reserve(faces.size() * 3); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    output_parametric_planes.resize(subfaces.size()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    auto active_patch_index = active_patch_label.find_first(); | 
					 | 
					 | 
					    auto active_patch_index = active_patch_label.find_first(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    if (active_patch_index != dynamic_bitset_mp<>::npos) { | 
					 | 
					 | 
					    if (active_patch_index != dynamic_bitset_mp<>::npos) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        do { | 
					 | 
					 | 
					        do { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            // const auto subface_index = faces[patches.]
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            // NOTE: since patch inside the sdf should be oriented counterclockwise when viewed from inside
 | 
					 | 
					 | 
					            // NOTE: since patch inside the sdf should be oriented counterclockwise when viewed from inside
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            // i.e. it is viewed to be clockwise when viewed from outside
 | 
					 | 
					 | 
					            // i.e. it is viewed to be clockwise when viewed from outside
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            // so we need to flip its vertex order here
 | 
					 | 
					 | 
					            // so we need to flip its vertex order here
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -66,25 +79,26 @@ void transfer_active_prims(const stl_vector_mp<polygon_face_t>& faces, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            // (i.e. clockwise), then its normal should point to the other side of that surface, which is the
 | 
					 | 
					 | 
					            // (i.e. clockwise), then its normal should point to the other side of that surface, which is the
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            // outside of that surface, so it is also right
 | 
					 | 
					 | 
					            // outside of that surface, so it is also right
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            if (!patch_sign_label[active_patch_index]) { | 
					 | 
					 | 
					            if (!patch_sign_label[active_patch_index]) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                patches.loop_on_group(active_patch_index, [&](uint32_t _, uint32_t face_index) { | 
					 | 
					 | 
					                for (auto face_index : patches.group(active_patch_index)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    const auto& face_vertices = faces[face_index].vertex_indices; | 
					 | 
					 | 
					                    const auto& face_vertices = faces[face_index].vertex_indices; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    output_vertex_counts_of_face.emplace_back(face_vertices.size()); | 
					 | 
					 | 
					                    output_vertex_counts_of_face.emplace_back(face_vertices.size()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    output_polygon_faces.insert(output_polygon_faces.end(), | 
					 | 
					 | 
					                    output_polygon_faces.insert(output_polygon_faces.end(), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                                std::make_move_iterator(face_vertices.rbegin()), | 
					 | 
					 | 
					                                                std::make_move_iterator(face_vertices.rbegin()), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                                std::make_move_iterator(face_vertices.rend())); | 
					 | 
					 | 
					                                                std::make_move_iterator(face_vertices.rend())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                }); | 
					 | 
					 | 
					                } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            } else { | 
					 | 
					 | 
					            } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                patches.loop_on_group(active_patch_index, [&](uint32_t _, uint32_t face_index) { | 
					 | 
					 | 
					                for (auto face_index : patches.group(active_patch_index)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                    const auto& face_vertices = faces[face_index].vertex_indices; | 
					 | 
					 | 
					                    const auto& face_vertices = faces[face_index].vertex_indices; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    output_vertex_counts_of_face.emplace_back(face_vertices.size()); | 
					 | 
					 | 
					                    output_vertex_counts_of_face.emplace_back(face_vertices.size()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                    output_polygon_faces.insert(output_polygon_faces.end(), | 
					 | 
					 | 
					                    output_polygon_faces.insert(output_polygon_faces.end(), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                                std::make_move_iterator(face_vertices.begin()), | 
					 | 
					 | 
					                                                std::make_move_iterator(face_vertices.begin()), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                                                std::make_move_iterator(face_vertices.end())); | 
					 | 
					 | 
					                                                std::make_move_iterator(face_vertices.end())); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                }); | 
					 | 
					 | 
					                } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            chain_of_patch.loop_on_group(active_patch_index, | 
					 | 
					 | 
					            for (auto chain_index : chain_of_patch.group(active_patch_index)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                                         [&](uint32_t _, uint32_t chain_index) { active_chain_label[chain_index].set(); }); | 
					 | 
					 | 
					                 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            active_patch_index = active_patch_label.find_next(active_patch_index); | 
					 | 
					 | 
					            active_patch_index = active_patch_label.find_next(active_patch_index); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } while (active_patch_index != dynamic_bitset_mp<>::npos); | 
					 | 
					 | 
					        } while (active_patch_index != dynamic_bitset_mp<>::npos); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |