@ -1,17 +1,17 @@
# include <topology_ray_shooting.hpp>
# include <topology_ray_shooting.hpp>
# include <patch_connectivity.hpp>
# include <patch_connectivity.hpp>
ISNP_API void topo_ray_shooting ( const tetrahedron_mesh_t & tet_mesh ,
ISNP_API void topo_ray_shooting ( const tetrahedron_mesh_t & tet_mesh ,
const stl_vector_mp < std : : shared_ptr < arrangement_t > > & cut_results ,
const stl_vector_mp < std : : optional < arrangement_t > > & cut_results ,
const stl_vector_mp < iso_vertex_t > & iso_verts ,
const stl_vector_mp < iso_vertex_t > & iso_verts ,
const stl_vector_mp < polygon_face_t > & iso_faces ,
const stl_vector_mp < polygon_face_t > & iso_faces ,
const stl_vector_mp < stl_vector_mp < uint32_t > > & patches ,
const stl_vector_mp < stl_vector_mp < uint32_t > > & patches ,
const stl_vector_mp < uint32_t > & patch_of_face ,
const stl_vector_mp < uint32_t > & patch_of_face ,
const stl_vector_mp < stl_vector_mp < uint32_t > > & shells ,
const stl_vector_mp < stl_vector_mp < uint32_t > > & shells ,
const stl_vector_mp < uint32_t > & shell_of_half_patch ,
const stl_vector_mp < uint32_t > & shell_of_half_patch ,
const stl_vector_mp < stl_vector_mp < uint32_t > > & components ,
const stl_vector_mp < stl_vector_mp < uint32_t > > & components ,
const stl_vector_mp < uint32_t > & component_of_patch ,
const stl_vector_mp < uint32_t > & component_of_patch ,
stl_vector_mp < std : : pair < uint32_t , uint32_t > > & shell_links )
stl_vector_mp < std : : pair < uint32_t , uint32_t > > & shell_links )
{
{
// map: tet vert index --> index of next vert (with smaller (x,y,z))
// map: tet vert index --> index of next vert (with smaller (x,y,z))
stl_vector_mp < uint32_t > next_vert { } ;
stl_vector_mp < uint32_t > next_vert { } ;
@ -50,7 +50,7 @@ ISNP_API void topo_ray_shooting(const tetrahedron_mesh_t
const auto extreme_v2 = extremal_edge_of_component [ 2 * i + 1 ] ;
const auto extreme_v2 = extremal_edge_of_component [ 2 * i + 1 ] ;
const auto iso_vId = iso_vert_on_v_v_next [ extreme_v1 ] ;
const auto iso_vId = iso_vert_on_v_v_next [ extreme_v1 ] ;
const auto tetId = iso_verts [ iso_vId ] . header . volume_index ;
const auto tetId = iso_verts [ iso_vId ] . header . volume_index ;
const auto & tet_cut_result = * cut_results [ tetId ] . get ( ) ;
const auto & tet_cut_result = cut_results [ tetId ] . value ( ) ;
// get local index of v1 and v2 in the tet
// get local index of v1 and v2 in the tet
uint32_t local_v1 , local_v2 ;
uint32_t local_v1 , local_v2 ;
for ( uint32_t j = 0 ; j < 4 ; + + j ) {
for ( uint32_t j = 0 ; j < 4 ; + + j ) {
@ -107,7 +107,7 @@ ISNP_API void topo_ray_shooting(const tetrahedron_mesh_t
// reached iso-vert at end of the ray
// reached iso-vert at end of the ray
const auto iso_vId_end = iso_vert_on_v_v_next [ v_curr ] ;
const auto iso_vId_end = iso_vert_on_v_v_next [ v_curr ] ;
const auto end_tetId = iso_verts [ iso_vId_end ] . header . volume_index ;
const auto end_tetId = iso_verts [ iso_vId_end ] . header . volume_index ;
const auto & end_tet_cut_result = * cut_results [ end_tetId ] . get ( ) ;
const auto & end_tet_cut_result = cut_results [ end_tetId ] . value ( ) ;
auto v_next = next_vert [ v_curr ] ;
auto v_next = next_vert [ v_curr ] ;
// find local vertex indices in the end tetrahedron
// find local vertex indices in the end tetrahedron
for ( uint32_t j = 0 ; j < 4 ; + + j ) {
for ( uint32_t j = 0 ; j < 4 ; + + j ) {
@ -307,8 +307,8 @@ ISNP_API void compute_edge_intersection_order(const arrangement_t &tet_cut_r
const auto num_vert = face . vertices . size ( ) ;
const auto num_vert = face . vertices . size ( ) ;
for ( uint32_t i = 0 ; i < num_vert ; + + i ) {
for ( uint32_t i = 0 ; i < num_vert ; + + i ) {
const auto i_next = ( i + 1 ) % num_vert ;
const auto i_next = ( i + 1 ) % num_vert ;
const auto vi = tet_cut_result . vertices [ fId ] [ i ] ;
const auto vi = face . vertices [ i ] ;
const auto vi_next = tet_cut_result . vertices [ fId ] [ i_next ] ;
const auto vi_next = face . vertices [ i_next ] ;
// add fId to edge (vi, vi_next)
// add fId to edge (vi, vi_next)
auto iter_inserted = faces_of_edge . try_emplace ( std : : make_pair ( vi , vi_next ) , std : : make_pair ( fId , invalid_index ) ) ;
auto iter_inserted = faces_of_edge . try_emplace ( std : : make_pair ( vi , vi_next ) , std : : make_pair ( fId , invalid_index ) ) ;
if ( ! iter_inserted . second ) { // inserted before
if ( ! iter_inserted . second ) { // inserted before
@ -359,8 +359,8 @@ ISNP_API void compute_edge_intersection_order(const arrangement_t &tet_cut_r
// visit all edges of face, find edge_prev, edge_next and edge_on_vu
// visit all edges of face, find edge_prev, edge_next and edge_on_vu
for ( uint32_t i = 0 ; i < num_vert ; + + i ) {
for ( uint32_t i = 0 ; i < num_vert ; + + i ) {
const auto i_next = ( i + 1 ) % num_vert ;
const auto i_next = ( i + 1 ) % num_vert ;
const auto vi = tet_cut_result . vertices [ f_curr ] [ i ] ;
const auto vi = face . vertices [ i ] ;
const auto vi_next = tet_cut_result . vertices [ f_curr ] [ i_next ] ;
const auto vi_next = face . vertices [ i_next ] ;
if ( is_on_edge_vu [ vi ] & & ! is_on_edge_vu [ vi_next ] ) {
if ( is_on_edge_vu [ vi ] & & ! is_on_edge_vu [ vi_next ] ) {
auto & two_faces = faces_of_edge [ std : : make_pair ( vi , vi_next ) ] ;
auto & two_faces = faces_of_edge [ std : : make_pair ( vi , vi_next ) ] ;
auto other_face = ( two_faces . first = = f_curr ) ? two_faces . second : two_faces . first ;
auto other_face = ( two_faces . first = = f_curr ) ? two_faces . second : two_faces . first ;