MCPcopy Create free account
hub / github.com/colmap/colmap / MakeCubeMesh

Function MakeCubeMesh

src/colmap/mvs/texture_mapping_test.cc:174–207  ·  view source on GitHub ↗

Create a 12-face cube mesh (2 triangles per face).

Source from the content-addressed store, hash-verified

172
173// Create a 12-face cube mesh (2 triangles per face).
174PlyMesh MakeCubeMesh() {
175 PlyMesh mesh;
176 mesh.vertices = {
177 PlyMeshVertex(0, 0, 0),
178 PlyMeshVertex(1, 0, 0),
179 PlyMeshVertex(1, 1, 0),
180 PlyMeshVertex(0, 1, 0),
181 PlyMeshVertex(0, 0, 1),
182 PlyMeshVertex(1, 0, 1),
183 PlyMeshVertex(1, 1, 1),
184 PlyMeshVertex(0, 1, 1),
185 };
186 mesh.faces = {
187 // Front (Z=0): 0,2,1 and 0,3,2
188 PlyMeshFace(0, 2, 1),
189 PlyMeshFace(0, 3, 2),
190 // Back (Z=1): 4,5,6 and 4,6,7
191 PlyMeshFace(4, 5, 6),
192 PlyMeshFace(4, 6, 7),
193 // Left (X=0): 0,7,3 and 0,4,7
194 PlyMeshFace(0, 7, 3),
195 PlyMeshFace(0, 4, 7),
196 // Right (X=1): 1,6,5 and 1,2,6
197 PlyMeshFace(1, 6, 5),
198 PlyMeshFace(1, 2, 6),
199 // Bottom (Y=0): 0,5,4 and 0,1,5
200 PlyMeshFace(0, 5, 4),
201 PlyMeshFace(0, 1, 5),
202 // Top (Y=1): 3,6,2 and 3,7,6
203 PlyMeshFace(3, 6, 2),
204 PlyMeshFace(3, 7, 6),
205 };
206 return mesh;
207}
208
209TEST(MeshTextureMapping, EndToEnd) {
210 const PlyMesh mesh = MakeTriangleMesh();

Callers 1

TESTFunction · 0.85

Calls 2

PlyMeshVertexClass · 0.85
PlyMeshFaceClass · 0.85

Tested by

no test coverage detected