Subversion Repositories gelsvn

Rev

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

Rev 596 Rev 600
Line 45... Line 45...
45
#include <HMesh/x3d_save.h>
45
#include <HMesh/x3d_save.h>
46
#include <HMesh/obj_save.h>
46
#include <HMesh/obj_save.h>
47
#include <HMesh/off_save.h>
47
#include <HMesh/off_save.h>
48
#include <HMesh/mesh_optimization.h>
48
#include <HMesh/mesh_optimization.h>
49
#include <HMesh/triangulate.h>
49
#include <HMesh/triangulate.h>
50
#include <HMesh/close_holes.h>
50
#include <HMesh/cleanup.h>
51
#include <HMesh/caps_and_needles.h>
51
#include <HMesh/cleanup.h>
52
#include <HMesh/refine_edges.h>
52
#include <HMesh/refine_edges.h>
53
#include <HMesh/subdivision.h>
53
#include <HMesh/subdivision.h>
54
 
54
 
55
#include <Util/Timer.h>
55
#include <Util/Timer.h>
56
#include <Util/ArgExtracter.h>
56
#include <Util/ArgExtracter.h>
Line 908... Line 908...
908
    active_mesh().cleanup();
908
    active_mesh().cleanup();
909
	valid(active_mesh());
909
	valid(active_mesh());
910
    return;
910
    return;
911
}
911
}
912
 
912
 
-
 
913
void console_remove_faces(const std::vector<std::string> & args)
-
 
914
{
-
 
915
    avo().save_old();
-
 
916
    
-
 
917
    gel_srand(0);
-
 
918
 
-
 
919
//    for (FaceIDIterator f= active_mesh().faces_begin(); f != active_mesh().faces_end(); ++f) {
-
 
920
//        if(gel_rand() < 0.5 * GEL_RAND_MAX)
-
 
921
//        {
-
 
922
//            active_mesh().remove_face(*f);
-
 
923
//        }
-
 
924
//    }
-
 
925
 
-
 
926
//    for (VertexIDIterator v= active_mesh().vertices_begin(); v != active_mesh().vertices_end(); ++v) {
-
 
927
//        if(gel_rand() < 0.005 * GEL_RAND_MAX)
-
 
928
//        {
-
 
929
//            active_mesh().remove_vertex(*v);
-
 
930
//        }
-
 
931
//    }
-
 
932
    for (HalfEdgeIDIterator h= active_mesh().halfedges_begin(); h != active_mesh().halfedges_end(); ++h) {
-
 
933
        if(gel_rand() < 0.005 * GEL_RAND_MAX)
-
 
934
        {
-
 
935
            active_mesh().remove_edge(*h);
-
 
936
        }
-
 
937
    }
-
 
938
 
-
 
939
    active_mesh().cleanup();
-
 
940
    valid(active_mesh());
-
 
941
	
-
 
942
    return;
-
 
943
}
-
 
944
 
913
 
945
 
914
void console_remove_caps(const std::vector<std::string> & args)
946
void console_remove_caps(const std::vector<std::string> & args)
915
{	
947
{	
916
    if(wantshelp(args)) {
948
    if(wantshelp(args)) {
917
        theConsole.printf("usage:  cleanup.remove_caps thresh");
949
        theConsole.printf("usage:  cleanup.remove_caps thresh");
Line 1006... Line 1038...
1006
void mouse(int button, int state, int x, int y) 
1038
void mouse(int button, int state, int x, int y) 
1007
{
1039
{
1008
    Vec2i pos(x,y);
1040
    Vec2i pos(x,y);
1009
    if (state==GLUT_DOWN) 
1041
    if (state==GLUT_DOWN) 
1010
    {
1042
    {
1011
        if (button==GLUT_LEFT_BUTTON) 
1043
        if (button==GLUT_LEFT_BUTTON && glutGetModifiers() == 0)
1012
            active_view_control().grab_ball(ROTATE_ACTION,pos);
1044
            active_view_control().grab_ball(ROTATE_ACTION,pos);
1013
        else if (button==GLUT_MIDDLE_BUTTON) 
1045
        else if (button==GLUT_MIDDLE_BUTTON || glutGetModifiers() == GLUT_ACTIVE_CTRL) 
1014
            active_view_control().grab_ball(ZOOM_ACTION,pos);
1046
            active_view_control().grab_ball(ZOOM_ACTION,pos);
1015
        else if (button==GLUT_RIGHT_BUTTON) 
1047
        else if (button==GLUT_RIGHT_BUTTON || glutGetModifiers() == GLUT_ACTIVE_ALT)
1016
            active_view_control().grab_ball(PAN_ACTION,pos);
1048
            active_view_control().grab_ball(PAN_ACTION,pos);
1017
    }
1049
    }
1018
    else if (state==GLUT_UP)
1050
    else if (state==GLUT_UP)
1019
        active_view_control().release_ball();
1051
        active_view_control().release_ball();
1020
}
1052
}
Line 1165... Line 1197...
1165
    theConsole.reg_cmdN("save_mesh", console_save,"");
1197
    theConsole.reg_cmdN("save_mesh", console_save,"");
1166
    theConsole.reg_cmdN("noise.perturb_vertices", console_vertex_noise,"");
1198
    theConsole.reg_cmdN("noise.perturb_vertices", console_vertex_noise,"");
1167
    theConsole.reg_cmdN("noise.perturb_vertices_perpendicular", console_perpendicular_vertex_noise,"");
1199
    theConsole.reg_cmdN("noise.perturb_vertices_perpendicular", console_perpendicular_vertex_noise,"");
1168
    theConsole.reg_cmdN("noise.perturb_topology", console_noisy_flips,"");
1200
    theConsole.reg_cmdN("noise.perturb_topology", console_noisy_flips,"");
1169
 
1201
 
-
 
1202
    theConsole.reg_cmdN("remove_faces", console_remove_faces,"");
-
 
1203
 
1170
    theConsole.reg_cmdN("dual", console_dual,"");
1204
    theConsole.reg_cmdN("dual", console_dual,"");
1171
    theConsole.reg_cmdN("flatten", console_flatten,"");
1205
    theConsole.reg_cmdN("flatten", console_flatten,"");
1172
	
1206
	
1173
    theConsole.reg_cmdN("align", console_align,"");
1207
    theConsole.reg_cmdN("align", console_align,"");
1174
	
1208