@@ -16,41 +16,61 @@ int main() {
1616
1717 // --- CREATE ---
1818
19- // Create 3 points in polyline
20- p.points .create_points (3 );
21- p.points [0 ] = {0 ,0 ,0 };
22- p.points [1 ] = {1 ,0 ,0 };
23- p.points [2 ] = {1 ,1 ,0 };
19+ // Create 5 points in polyline
20+ p.points .create_points (5 );
21+ p.points [0 ] = vec3 (0 , 0 , 0 );
22+ p.points [1 ] = vec3 (1 , 0 , 0 );
23+ p.points [2 ] = vec3 (1 , 1 , 0 );
24+ p.points [3 ] = vec3 (0 , 1 , 0 );
25+ p.points [4 ] = vec3 (0.5 , 0.5 , 1 );
2426
2527 // Create edges
26- p.create_edges (2 );
28+ p.create_edges (8 );
2729
2830 // Link segment 0 with point 0
2931 p.vert (0 , 0 ) = 0 ;
3032 // Link segment 0 with point 1
3133 p.vert (0 , 1 ) = 1 ;
34+
3235 // Link segment 1 with point 0
33- p.vert (1 , 0 ) = 0 ;
36+ p.vert (1 , 0 ) = 1 ;
3437 // ...
3538 p.vert (1 , 1 ) = 2 ;
3639
37- EdgeAttribute<int > edge_attr (p);
40+ p.vert (2 , 0 ) = 2 ;
41+ p.vert (2 , 1 ) = 3 ;
42+
43+ p.vert (3 , 0 ) = 3 ;
44+ p.vert (3 , 1 ) = 0 ;
45+
46+ p.vert (4 , 0 ) = 0 ;
47+ p.vert (4 , 1 ) = 4 ;
3848
49+ p.vert (5 , 0 ) = 1 ;
50+ p.vert (5 , 1 ) = 4 ;
51+
52+ p.vert (6 , 0 ) = 2 ;
53+ p.vert (6 , 1 ) = 4 ;
54+
55+ p.vert (7 , 0 ) = 3 ;
56+ p.vert (7 , 1 ) = 4 ;
57+
58+ EdgeAttribute<int > edge_attr (p);
3959 edge_attr[0 ] = 0 ;
4060 edge_attr[1 ] = 1 ;
4161
4262 // --- SAVE ---
4363
4464 // Save mesh
45- write_by_extension (" simple_polyline .geogram" , p, {{}, {{ " my_edge_attr" , edge_attr. ptr } }});
65+ write_by_extension (" pyramid .geogram" , p, {{" my_edge_attr" , edge_attr}});
4666
4767 // --- END ---
4868
4969 // --- RUN ---
5070
5171 #ifdef _WIN32
5272 // Open the generated mesh with Graphite
53- int result = system ((getGraphitePath () + " simple_polyline .geogram" ).c_str ());
73+ int result = system ((getGraphitePath () + " pyramid .geogram" ).c_str ());
5474 #endif
5575
5676 return 0 ;
0 commit comments