forked from libigl/libigl-example-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (36 loc) · 780 Bytes
/
main.cpp
File metadata and controls
39 lines (36 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <igl/opengl/glfw/Viewer.h>
#include <igl/loop.h>
int main(int argc, char *argv[])
{
// Inline mesh of a cube
const Eigen::MatrixXd V= (Eigen::MatrixXd(8,3)<<
0.0,0.0,0.0,
0.0,0.0,1.0,
0.0,1.0,0.0,
0.0,1.0,1.0,
1.0,0.0,0.0,
1.0,0.0,1.0,
1.0,1.0,0.0,
1.0,1.0,1.0).finished();
const Eigen::MatrixXi F = (Eigen::MatrixXi(12,3)<<
0,6,4,
0,2,6,
0,3,2,
0,1,3,
2,7,6,
2,3,7,
4,6,7,
4,7,5,
0,4,5,
0,5,1,
1,5,7,
1,7,3).finished();
Eigen::MatrixXd SV;
Eigen::MatrixXi SF;
igl::loop(V, F, SV, SF, 1);
// Plot the mesh
igl::opengl::glfw::Viewer viewer;
viewer.data().set_mesh(SV, SF);
viewer.data().set_face_based(true);
viewer.launch();
}