MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test_create_polyhedra

Function test_create_polyhedra

tests/mesh/test-polyhedral-solid.cpp:91–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void test_create_polyhedra( const geode::PolyhedralSolid3D& polyhedral_solid,
92 geode::PolyhedralSolidBuilder3D& builder )
93{
94 builder.create_polyhedron(
95 { 0, 1, 2, 3, 4, 5 }, { { 0, 1, 2 }, { 3, 5, 4 }, { 0, 3, 4, 1 },
96 { 0, 2, 5, 3 }, { 1, 4, 5, 2 } } );
97 builder.create_polyhedron( { 3, 4, 5, 6 },
98 { { 1, 3, 2 }, { 0, 2, 3 }, { 3, 1, 0 }, { 0, 1, 2 } } );
99 builder.create_polyhedron( { 4, 5, 6, 7 },
100 { { 1, 3, 2 }, { 0, 2, 3 }, { 3, 1, 0 }, { 0, 1, 2 } } );
101 geode::OpenGeodeMeshException::test( polyhedral_solid.nb_polyhedra() == 3,
102 "PolyhedralSolid should have 3 polyhedra" );
103 geode::OpenGeodeMeshException::test(
104 polyhedral_solid.facets().nb_facets() == 11,
105 "PolyhedralSolid should have 11 facets" );
106 geode::OpenGeodeMeshException::test(
107 polyhedral_solid.edges().nb_edges() == 15,
108 "PolyhedralSolid should have 15 edges" );
109 geode::OpenGeodeMeshException::test(
110 !polyhedral_solid.is_vertex_isolated( 0 ),
111 "Vertices should not be isolated after polyhedra creation" );
112
113 geode::OpenGeodeMeshException::test(
114 polyhedral_solid.edges().edge_from_vertices(
115 polyhedral_solid.polyhedron_facet_edge_vertices( { { 0, 1 }, 2 } ) )
116 == 4,
117 "Wrong edge index get from PolyhedronFacetEdge" );
118 geode::OpenGeodeMeshException::test(
119 !polyhedral_solid.vertex_in_polyhedron( 0, 7 ),
120 "Wrong vertex in polyhedron" );
121 geode::OpenGeodeMeshException::test(
122 polyhedral_solid.vertex_in_polyhedron( 1, 5 ).has_value(),
123 "Wrong vertex in polyhedron" );
124 geode::PolyhedronVertices answer{ 3, 4, 5, 6 };
125 geode::OpenGeodeMeshException::test(
126 polyhedral_solid.polyhedron_vertices( 1 ) == answer,
127 "Wrong polyhedron vertices list" );
128}
129
130void test_create_facet_attribute(
131 const geode::PolyhedralSolid3D& polyhedral_solid )

Callers 1

testFunction · 0.70

Calls 10

create_polyhedronMethod · 0.80
nb_polyhedraMethod · 0.80
vertex_in_polyhedronMethod · 0.80
polyhedron_verticesMethod · 0.80
testFunction · 0.70
nb_facetsMethod · 0.45
nb_edgesMethod · 0.45
is_vertex_isolatedMethod · 0.45
edge_from_verticesMethod · 0.45

Tested by

no test coverage detected