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

Function test_hybrid_solid

tests/mesh/test-convert-solid.cpp:134–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134void test_hybrid_solid()
135{
136 geode::OpenGeodeMeshLibrary::initialize();
137 std::vector< geode::Point3D > hex_points{
138 geode::Point3D{ { 0, 0, 0 } },
139 geode::Point3D{ { 1, 0, 0 } },
140 geode::Point3D{ { 0, 1, 0 } },
141 geode::Point3D{ { 1, 1, 0 } },
142 geode::Point3D{ { 0, 0, 1 } },
143 geode::Point3D{ { 1, 0, 1 } },
144 geode::Point3D{ { 0, 1, 1 } },
145 geode::Point3D{ { 1, 1, 1 } },
146 };
147 auto hex = geode::SolidMesh3D::create();
148 auto builder_hex = geode::SolidMeshBuilder3D::create( *hex );
149 for( const auto& point : hex_points )
150 {
151 builder_hex->create_point( point );
152 }
153 builder_hex->create_polyhedron( { 0, 1, 2, 3, 4, 5, 6, 7 },
154 { { 0, 1, 3, 2 }, { 0, 4, 5, 1 }, { 3, 1, 5, 7 }, { 4, 6, 7, 5 },
155 { 2, 3, 7, 6 }, { 0, 2, 6, 4 } } );
156 auto hybrid_solid_hex = geode::convert_solid_mesh_into_hybrid_solid( *hex );
157 geode::save_hybrid_solid(
158 *hybrid_solid_hex.value(), "hybrid_solid_hex.og_hso3d" );
159 std::vector< geode::Point3D > prism_points{
160 geode::Point3D{ { 0, 0, 0 } },
161 geode::Point3D{ { 1, 0, 0 } },
162 geode::Point3D{ { 0.5, 1, 0 } },
163 geode::Point3D{ { 0, 0, 1 } },
164 geode::Point3D{ { 1, 0, 1 } },
165 geode::Point3D{ { 0.5, 1, 1 } },
166 };
167 auto prism = geode::SolidMesh3D::create();
168 auto builder_prism = geode::SolidMeshBuilder3D::create( *prism );
169 for( const auto& point : prism_points )
170 {
171 builder_prism->create_point( point );
172 }
173 builder_prism->create_polyhedron(
174 { 0, 1, 2, 3, 4, 5 }, { { 0, 1, 2 }, { 3, 5, 4 }, { 0, 3, 4, 1 },
175 { 0, 2, 5, 3 }, { 1, 4, 5, 2 } } );
176 auto hybrid_solid_prism =
177 geode::convert_solid_mesh_into_hybrid_solid( *prism );
178 geode::save_hybrid_solid(
179 *hybrid_solid_prism.value(), "hybrid_solid_prism.og_hso3d" );
180 std::vector< geode::Point3D > pyramid_points{ geode::Point3D{ { 0, 0, 0 } },
181 geode::Point3D{ { 1, 0, 0 } }, geode::Point3D{ { 1, 1, 0 } },
182 geode::Point3D{ { 0, 1, 0 } }, geode::Point3D{ { 0.5, 0.5, 1 } } };
183 auto pyramid = geode::SolidMesh3D::create();
184 auto builder_pyramid = geode::SolidMeshBuilder3D::create( *pyramid );
185 for( const auto& point : pyramid_points )
186 {
187 builder_pyramid->create_point( point );
188 }
189 builder_pyramid->create_polyhedron(
190 { 0, 1, 2, 3, 4 }, { { 0, 4, 1 }, { 3, 4, 0 }, { 1, 4, 2 }, { 4, 3, 2 },
191 { 0, 1, 2, 3 } } );

Callers 1

testFunction · 0.85

Calls 6

initializeFunction · 0.85
save_hybrid_solidFunction · 0.85
create_polyhedronMethod · 0.80
create_pointMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected