本文整理汇总了C++中igl::ReTwBar::save方法的典型用法代码示例。如果您正苦于以下问题:C++ ReTwBar::save方法的具体用法?C++ ReTwBar::save怎么用?C++ ReTwBar::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类igl::ReTwBar
的用法示例。
在下文中一共展示了ReTwBar::save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: key
void key(unsigned char key, int mouse_x, int mouse_y)
{
using namespace std;
using namespace igl;
switch(key)
{
// ESC
case char(27):
rebar.save(REBAR_NAME);
// ^C
case char(3):
exit(0);
case ' ':
{
static double pause_start,pause_stop;
paused = !paused;
if(paused)
{
pause_start = get_seconds();
}else
{
pause_stop = get_seconds();
pause_time += (pause_stop-pause_start);
}
break;
}
default:
if(!TwEventKeyboardGLUT(key,mouse_x,mouse_y))
{
cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
}
}
glutPostRedisplay();
}
示例2: key
void key(unsigned char key, int mouse_x, int mouse_y)
{
using namespace std;
switch(key)
{
// ESC
case char(27):
rebar.save(REBAR_NAME);
// ^C
case char(3):
exit(0);
default:
if(!TwEventKeyboardGLUT(key,mouse_x,mouse_y))
{
cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
}
}
}
示例3: key
void key(unsigned char key, int mouse_x, int mouse_y)
{
using namespace std;
using namespace igl;
using namespace Eigen;
int mod = glutGetModifiers();
const bool command_down = GLUT_ACTIVE_COMMAND & mod;
const bool shift_down = GLUT_ACTIVE_SHIFT & mod;
switch(key)
{
// ESC
case char(27):
rebar.save(REBAR_NAME);
// ^C
case char(3):
exit(0);
case 'z':
case 'Z':
if(command_down)
{
if(shift_down)
{
redo();
}else
{
undo();
}
break;
}else
{
push_undo();
Quaterniond q;
snap_to_canonical_view_quat(s.camera.m_rotation_conj,1.0,q);
s.camera.orbit(q.conjugate());
}
default:
if(!TwEventKeyboardGLUT(key,mouse_x,mouse_y))
{
cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
}
}
}
示例4: key
void key(unsigned char key, int mouse_x, int mouse_y)
{
using namespace std;
using namespace igl;
using namespace Eigen;
int mod = glutGetModifiers();
const bool command_down = GLUT_ACTIVE_COMMAND & mod;
const bool shift_down = GLUT_ACTIVE_SHIFT & mod;
switch(key)
{
// ESC
case char(27):
rebar.save(REBAR_NAME);
// ^C
case char(3):
exit(0);
case char(127):
{
push_undo();
// delete
MatrixXi new_BE(s.BE.rows(),s.BE.cols());
int count = 0;
for(int b=0;b<s.BE.rows();b++)
{
bool selected = false;
for(int si=0;si<s.sel.size();si++)
{
if(s.BE(b,0) == s.sel(si) || s.BE(b,1) == s.sel(si))
{
selected = true;
break;
}
}
if(!selected)
{
new_BE.row(count) = s.BE.row(b);
count++;
}
}
new_BE.conservativeResize(count,new_BE.cols());
const auto old_C = s.C;
VectorXi I;
remove_unreferenced(old_C,new_BE,s.C,s.BE,I);
s.sel.resize(0,1);
break;
}
case 'A':
case 'a':
{
push_undo();
s.sel = colon<int>(0,s.C.rows()-1);
break;
}
case 'C':
case 'c':
{
push_undo();
// snap close vertices
SparseMatrix<double> A;
adjacency_matrix(s.BE,A);
VectorXi J = colon<int>(0,s.C.rows()-1);
// stupid O(n²) version
for(int c = 0;c<s.C.rows();c++)
{
for(int d = c+1;d<s.C.rows();d++)
{
if(
A.coeff(c,d) == 0 && // no edge
(s.C.row(c)-s.C.row(d)).norm() < 0.02*bbd //close
)
{
// c < d
J(d) = c;
}
}
}
for(int e = 0;e<s.BE.rows();e++)
{
s.BE(e,0) = J(s.BE(e,0));
s.BE(e,1) = J(s.BE(e,1));
}
const auto old_BE = s.BE;
const auto old_C = s.C;
VectorXi I;
remove_unreferenced(old_C,old_BE,s.C,s.BE,I);
for(int i = 0;i<s.sel.size();i++)
{
s.sel(i) = J(s.sel(i));
}
VectorXi _;
igl::unique(s.sel,s.sel,_,_);
break;
}
case 'D':
case 'd':
{
push_undo();
s.sel.resize(0,1);
break;
}
//.........这里部分代码省略.........
示例5: key
void key(unsigned char key, int mouse_x, int mouse_y)
{
using namespace std;
using namespace Eigen;
using namespace igl;
int mod = glutGetModifiers();
switch(key)
{
// ESC
case char(27):
rebar.save(REBAR_NAME);
// ^C
case char(3):
exit(0);
case 'I':
case 'i':
{
push_undo();
s.N *= -1.0;
F = F.rowwise().reverse().eval();
break;
}
case 'z':
case 'Z':
if(mod & GLUT_ACTIVE_COMMAND)
{
if(mod & GLUT_ACTIVE_SHIFT)
{
redo();
}else
{
undo();
}
}else
{
push_undo();
Quaterniond q;
snap_to_canonical_view_quat(s.camera.m_rotation_conj,1.0,q);
switch(center_type)
{
default:
case CENTER_TYPE_ORBIT:
s.camera.orbit(q.conjugate());
break;
case CENTER_TYPE_FPS:
s.camera.turn_eye(q.conjugate());
break;
}
}
break;
case 'u':
mouse_wheel(0, 1,mouse_x,mouse_y);
break;
case 'j':
mouse_wheel(0,-1,mouse_x,mouse_y);
break;
case 'n':
cc_selected = (cc_selected + 1) % (CC.maxCoeff() + 2);
cout << "selected cc: " << cc_selected << endl;
glutPostRedisplay();
break;
default:
if(!TwEventKeyboardGLUT(key,mouse_x,mouse_y))
{
cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
}
}
}