@@ -25,29 +25,29 @@ def similarity_overlay_one(args, fname):
2525 output_dir = script_util .get_mesh_output_directory (args ['output_dir' ], m )
2626 os .makedirs (output_dir , exist_ok = True )
2727
28+ # Skip meshes that are already processed
29+ try :
30+ uv_mesh_path = os .path .join (output_dir , name + '_refined_with_uv.obj' )
31+ V , F = igl .read_triangle_mesh (uv_mesh_path )
32+ if (len (V ) > 0 ):
33+ print ("Skipping processed mesh" )
34+ return
35+ except :
36+ pass
37+
2838 # Get logger
2939 log_path = os .path .join (output_dir , name + '_convert_to_vf.log' )
3040 logger = script_util .get_logger (log_path )
3141 logger .info ("Converting {} to vf" .format (name ))
3242
3343 try :
3444 V , F = igl .read_triangle_mesh (os .path .join (args ['input_dir' ], fname ))
45+ Th_hat = np .loadtxt (os .path .join (output_dir , m + '_Th_hat' ), dtype = float )
46+ rotation_form = np .loadtxt (os .path .join (output_dir , m + '_kappa_hat' ), dtype = float )
3547 except :
3648 logger .info ("Could not open mesh data at {}" , args ['input_dir' ])
3749 return
3850
39- if args ['fit_field' ]:
40- field_params = holonomy .FieldParameters ()
41- field_params .min_angle = np .pi
42- rotation_form , Th_hat = holonomy .generate_intrinsic_rotation_form (V , F , field_params )
43- else :
44- try :
45- Th_hat = np .loadtxt (os .path .join (args ['input_dir' ], name + "_Th_hat" ), dtype = float )
46- rotation_form = np .loadtxt (os .path .join (args ['input_dir' ], name + "_kappa_hat" ), dtype = float )
47- except :
48- logger .info ("Could not open rotation form" )
49- return
50-
5151 # Get final optimized lambdas
5252 try :
5353 metric_coords_path = os .path .join (output_dir , name + "_metric_coords" )
@@ -95,11 +95,6 @@ def similarity_overlay_one(args, fname):
9595 refinement_mesh = opt .RefinementMesh (V_o , F_o , uv_o , FT_o , fn_to_f_o , endpoints_o )
9696 V_r , F_r , uv_r , FT_r , fn_to_f_r , endpoints_r = refinement_mesh .get_VF_mesh ()
9797
98- # Write combined refined mesh with uv
99- uv_mesh_path = os .path .join (output_dir , name + '_refined_with_uv.obj' )
100- logger .info ("Saving refined uv mesh at {}" .format (uv_mesh_path ))
101- opt .write_obj_with_uv (uv_mesh_path , V_r , F_r , uv_r , FT_r )
102-
10398 # Save cut information
10499 simp_path = os .path .join (output_dir , name + '_is_cut_h' )
105100 logger .info ("Saving cut information at {}" .format (simp_path ))
@@ -137,6 +132,11 @@ def similarity_overlay_one(args, fname):
137132 logger .info ("Saving endpoints at {}" .format (endpoints_path ))
138133 np .savetxt (endpoints_path , endpoints_o , fmt = '%i' )
139134
135+ # Write combined refined mesh with uv
136+ uv_mesh_path = os .path .join (output_dir , name + '_refined_with_uv.obj' )
137+ logger .info ("Saving refined uv mesh at {}" .format (uv_mesh_path ))
138+ opt .write_obj_with_uv (uv_mesh_path , V_r , F_r , uv_r , FT_r )
139+
140140def similarity_overlay_many (args ):
141141 script_util .run_many (similarity_overlay_one , args )
142142
0 commit comments