generated 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
34 lines (32 loc) · 686 Bytes
/
main.cpp
File metadata and controls
34 lines (32 loc) · 686 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
#include <igl/opengl/glfw/Viewer.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)<<
1,7,5,
1,3,7,
1,4,3,
1,2,4,
3,8,7,
3,4,8,
5,7,8,
5,8,6,
1,5,6,
1,6,2,
2,6,8,
2,8,4).finished().array()-1;
// Plot the mesh
igl::opengl::glfw::Viewer viewer;
viewer.data().set_mesh(V, F);
viewer.data().set_face_based(true);
viewer.launch();
}