Subversion Repositories gelsvn

Rev

Rev 631 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 631 Rev 643
Line 202... Line 202...
202
{
202
{
203
    if(wantshelp(args)) {
203
    if(wantshelp(args)) {
204
        theConsole.printf("usage: polarize");
204
        theConsole.printf("usage: polarize");
205
        return;
205
        return;
206
    }
206
    }
207
    int divisions = 10;
207
    int divisions = 50;
208
	
208
	
209
    if(args.size() > 0){
209
    if(args.size() > 0){
210
        istringstream a0(args[0]);
210
        istringstream a0(args[0]);
211
        a0 >> divisions;
211
        a0 >> divisions;
212
    }
212
    }
213
 
213
 
-
 
214
    double t=1;
-
 
215
	
-
 
216
    if(args.size() > 1){
-
 
217
        istringstream a0(args[1]);
-
 
218
        a0 >> t;
-
 
219
    }
-
 
220
 
214
    avo().save_old();
221
    avo().save_old();
215
 
222
 
216
	double vmin, vmax;
223
	double vmin, vmax;
217
    VertexAttributeVector<double> fun;
224
    VertexAttributeVector<double> fun;
218
    VertexAttributeVector<Vec2d> par;
225
    VertexAttributeVector<Vec2d> par;
219
    make_height_fun(active_mesh(), fun, vmin, vmax);
226
    make_adf_fun(active_mesh(), t, fun, vmin, vmax);
220
    polarize_mesh(active_mesh(), fun, vmin, vmax, divisions, par);
227
    polarize_mesh(active_mesh(), fun, vmin, vmax, divisions, par);
221
}
228
}
222
 
229
 
-
 
230
void console_simplify_polar(const std::vector<std::string> & args)
-
 
231
{
-
 
232
    if(wantshelp(args)) {
-
 
233
        theConsole.printf("usage: simplify.polar <frac>");
-
 
234
        return;
-
 
235
    }
-
 
236
    double frac = 0.9;
-
 
237
    if(args.size() > 0){
-
 
238
        istringstream a0(args[0]);
-
 
239
        a0 >> frac;
-
 
240
    }
-
 
241
    
-
 
242
    
-
 
243
    avo().save_old();
-
 
244
    
-
 
245
    simplify_polar_mesh(avo().mesh(), frac);
-
 
246
}
-
 
247
 
-
 
248
void console_refit_polar(const std::vector<std::string> & args)
-
 
249
{
-
 
250
    if(wantshelp(args)) {
-
 
251
        theConsole.printf("usage: simplify.polar <mesh 1> <mesh 2> <iter>");
-
 
252
        return;
-
 
253
    }
-
 
254
    int m1=1;
-
 
255
    int m2=2;
-
 
256
    int iter=1;
-
 
257
    int dim = 64;
-
 
258
    if(args.size() > 0){
-
 
259
        istringstream a0(args[0]);
-
 
260
        a0 >> m1;
-
 
261
    }
-
 
262
    if(args.size() > 1){
-
 
263
        istringstream a0(args[1]);
-
 
264
        a0 >> m2;
-
 
265
    }
-
 
266
    if(args.size() > 2){
-
 
267
        istringstream a0(args[2]);
-
 
268
        a0 >> iter;
-
 
269
    }
-
 
270
 
-
 
271
    if(args.size() > 3){
-
 
272
        istringstream a0(args[3]);
-
 
273
        a0 >> dim;
-
 
274
    }
-
 
275
 
-
 
276
    
-
 
277
    
-
 
278
    avo().save_old();
-
 
279
    
-
 
280
    smooth_and_refit(get_vis_obj(m1-1).mesh() , get_vis_obj(m2-1).mesh(), iter, dim);
-
 
281
}
-
 
282
 
-
 
283
 
223
void transform_mesh(Manifold& mani, const Mat4x4d& m)
284
void transform_mesh(Manifold& mani, const Mat4x4d& m)
224
{
285
{
225
    for(VertexIDIterator vid = mani.vertices_begin(); vid != mani.vertices_end(); ++vid)
286
    for(VertexIDIterator vid = mani.vertices_begin(); vid != mani.vertices_end(); ++vid)
226
        mani.pos(*vid) = m.mul_3D_point(mani.pos(*vid));
287
        mani.pos(*vid) = m.mul_3D_point(mani.pos(*vid));
227
}
288
}
Line 581... Line 642...
581
        theConsole.printf("It also projects the vertices onto the eigenvectors - thus transforming the mesh");
642
        theConsole.printf("It also projects the vertices onto the eigenvectors - thus transforming the mesh");
582
        theConsole.printf("to this basis.");
643
        theConsole.printf("to this basis.");
583
        theConsole.printf("Note that this will stall the computer for a large mesh - as long as we use Lapack.");
644
        theConsole.printf("Note that this will stall the computer for a large mesh - as long as we use Lapack.");
584
        return;
645
        return;
585
    }
646
    }
586
    avo().harmonics_analyze_mesh(theConsole);
647
    avo().harmonics_analyze_mesh();
587
    return;
648
    return;
588
}
649
}
589
 
650
 
590
 
651
 
591
void console_partial_reconstruct(const std::vector<std::string> & args)
652
void console_partial_reconstruct(const std::vector<std::string> & args)
Line 1097... Line 1158...
1097
        theConsole.printf("usage:  undo");
1158
        theConsole.printf("usage:  undo");
1098
        theConsole.printf("This function undoes one operation. Repeated undo does nothing");
1159
        theConsole.printf("This function undoes one operation. Repeated undo does nothing");
1099
        return;
1160
        return;
1100
    }
1161
    }
1101
    avo().restore_old();
1162
    avo().restore_old();
1102
    avo().refit();
1163
    //avo().refit();
1103
    return;
1164
    return;
1104
}
1165
}
1105
 
1166
 
1106
 
1167
 
1107
void reshape(int W, int H)
1168
void reshape(int W, int H)
Line 1232... Line 1293...
1232
			case 'M':
1293
			case 'M':
1233
				display_render_mode = "mean_curvature"; break;
1294
				display_render_mode = "mean_curvature"; break;
1234
			case 'G':
1295
			case 'G':
1235
				display_render_mode = "gaussian_curvature"; break;
1296
				display_render_mode = "gaussian_curvature"; break;
1236
        }
1297
        }
1237
		
-
 
1238
        if(string(display_render_mode).substr(0,3) == "har")
-
 
1239
            avo().harmonics_parse_key(key);
-
 
1240
		
1298
				
1241
        if(key != '\033') avo().post_create_display_list();
1299
        if(key != '\033') avo().post_create_display_list();
1242
    }
1300
    }
1243
    
1301
    
1244
    glutPostRedisplay();
1302
    glutPostRedisplay();
1245
}
1303
}
Line 1322... Line 1380...
1322
	
1380
	
1323
	theConsole.reg_cmdN("validity", console_valid,"");
1381
	theConsole.reg_cmdN("validity", console_valid,"");
1324
	theConsole.reg_cmdN("info", console_info,"");
1382
	theConsole.reg_cmdN("info", console_info,"");
1325
 
1383
 
1326
    theConsole.reg_cmdN("polarize", console_polarize ,"");
1384
    theConsole.reg_cmdN("polarize", console_polarize ,"");
-
 
1385
    theConsole.reg_cmdN("polar.simplify", console_simplify_polar ,"");
-
 
1386
    theConsole.reg_cmdN("polar.refit", console_refit_polar ,"");
1327
    
1387
    
1328
    theConsole.reg_cmdN("transform.scale", console_scale, "Scale mesh");
1388
    theConsole.reg_cmdN("transform.scale", console_scale, "Scale mesh");
1329
    
1389
    
1330
    active.reg(theConsole, "active_mesh", "The active mesh");
1390
    active.reg(theConsole, "active_mesh", "The active mesh");
1331
    display_render_mode.reg(theConsole, "display.render_mode", "Display render mode");
1391
    display_render_mode.reg(theConsole, "display.render_mode", "Display render mode");