| 134 | } |
| 135 | |
| 136 | void 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 | |
| 157 | void test() |
| 158 | { |
no test coverage detected