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

Function triangulate_surface

tests/mesh/test-convert-surface.cpp:136–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void triangulate_surface()
137{
138 auto surface = geode::PolygonalSurface3D::create();
139 auto builder = geode::SurfaceMeshBuilder3D::create( *surface );
140
141 for( const auto i : geode::Range{ 10 } )
142 {
143 builder->create_point(
144 geode::Point3D{ { i * 0.5, i * 0.5, i * 0.5 } } );
145 }
146 builder->create_point( geode::Point3D{ { 10, 0, 10 } } );
147 std::vector< geode::index_t > polygon( surface->nb_vertices() );
148 absl::c_iota( polygon, 0 );
149 builder->create_polygon( polygon );
150 geode::triangulate_surface_mesh( *surface, *builder );
151 geode::save_polygonal_surface( *surface, "triangulated_surface.og_psf3d" );
152 geode::OpenGeodeMeshException::test( surface->nb_polygons() == 9,
153 "Number of polygons in TriangulatedSurface3D is not correct: ",
154 surface->nb_polygons() );
155}
156
157void test()
158{

Callers 1

testFunction · 0.85

Calls 7

triangulate_surface_meshFunction · 0.85
save_polygonal_surfaceFunction · 0.85
create_polygonMethod · 0.80
nb_polygonsMethod · 0.80
testFunction · 0.70
create_pointMethod · 0.45
nb_verticesMethod · 0.45

Tested by

no test coverage detected