#include #include int main() { // 8 vertices: unit cube vector3d verts[8] = { {0,0,0}, {1,0,0}, {1,1,0}, {0,1,0}, {0,0,1}, {1,0,1}, {1,1,1}, {0,1,1} }; // 6 faces, each with 4 vertices (counter-clockwise order when viewed from outside) uint32_t face_data[] = { 0,1,2,3, // bottom face 7,6,5,4, // top face (note CCW when seen from outside) 0,4,5,1, // front face 1,5,6,2, // right face 3,2,6,7, // back face 0,3,7,4 // left face }; uint32_t vertex_counts[6] = {4, 4, 4, 4, 4, 4}; polymesh_t mesh; mesh.vertices = verts; mesh.faces = face_data; mesh.vertex_counts = vertex_counts; mesh.num_vertices = 8; mesh.num_faces = 6; double area = compute_surface_area(&mesh); double volume = compute_volume(&mesh); std::cout << "area: " << area << std::endl; // expected: 6 std::cout << "volume: " << volume << std::endl; // expected: 1 return 0; }