| 156 | } |
| 157 | |
| 158 | void test_create_edges( const geode::EdgedCurve3D& edged_curve, |
| 159 | geode::EdgedCurveBuilder3D& builder ) |
| 160 | { |
| 161 | builder.create_edge( 0, 1 ); |
| 162 | builder.create_edge( 0, 2 ); |
| 163 | geode::OpenGeodeMeshException::test( |
| 164 | edged_curve.nb_edges() == 2, "EdgedCurve should have 2 edges" ); |
| 165 | geode::OpenGeodeMeshException::test( |
| 166 | edged_curve.edge_vertex( { 0, 1 } ) == 1, |
| 167 | "EdgedCurve edge vertex is not correct" ); |
| 168 | builder.create_edges( 2 ); |
| 169 | builder.set_edge_vertex( { 2, 0 }, 3 ); |
| 170 | builder.set_edge_vertex( { 2, 1 }, 2 ); |
| 171 | builder.set_edge_vertex( { 3, 0 }, 1 ); |
| 172 | builder.set_edge_vertex( { 3, 1 }, 2 ); |
| 173 | geode::OpenGeodeMeshException::test( |
| 174 | edged_curve.nb_edges() == 4, "EdgedCurve should have 4 edges" ); |
| 175 | |
| 176 | const auto& edges_around_0 = edged_curve.edges_around_vertex( 0 ); |
| 177 | geode::OpenGeodeMeshException::test( |
| 178 | edges_around_0.size() == 2, "edges_around_0 should have 2 edges" ); |
| 179 | geode::OpenGeodeMeshException::test( |
| 180 | edges_around_0[0].edge_id == 0, "edges_around_0 has wrong value" ); |
| 181 | geode::OpenGeodeMeshException::test( |
| 182 | edges_around_0[0].vertex_id == 0, "edges_around_0 has wrong value" ); |
| 183 | geode::OpenGeodeMeshException::test( |
| 184 | edges_around_0[1].edge_id == 1, "edges_around_0 has wrong value" ); |
| 185 | geode::OpenGeodeMeshException::test( |
| 186 | edges_around_0[1].vertex_id == 0, "edges_around_0 has wrong value" ); |
| 187 | |
| 188 | const auto& edges_around_2 = edged_curve.edges_around_vertex( 2 ); |
| 189 | geode::OpenGeodeMeshException::test( |
| 190 | edges_around_2.size() == 3, "edges_around_2 should have 3 edges" ); |
| 191 | geode::OpenGeodeMeshException::test( |
| 192 | edges_around_2[0].edge_id == 1, "edges_around_2 has wrong value" ); |
| 193 | geode::OpenGeodeMeshException::test( |
| 194 | edges_around_2[0].vertex_id == 1, "edges_around_2 has wrong value" ); |
| 195 | geode::OpenGeodeMeshException::test( |
| 196 | edges_around_2[1].edge_id == 2, "edges_around_2 has wrong value" ); |
| 197 | geode::OpenGeodeMeshException::test( |
| 198 | edges_around_2[1].vertex_id == 1, "edges_around_2 has wrong value" ); |
| 199 | geode::OpenGeodeMeshException::test( |
| 200 | edges_around_2[2].edge_id == 3, "edges_around_2 has wrong value" ); |
| 201 | geode::OpenGeodeMeshException::test( |
| 202 | edges_around_2[2].vertex_id == 1, "edges_around_2 has wrong value" ); |
| 203 | |
| 204 | const auto vertices_around_1 = edged_curve.vertices_around_vertex( 1 ); |
| 205 | geode::OpenGeodeMeshException::test( vertices_around_1.size() == 2, |
| 206 | "vertices_around_1 should have 2 vertices, not ", |
| 207 | vertices_around_1.size() ); |
| 208 | for( const auto vertex_id : vertices_around_1 ) |
| 209 | { |
| 210 | geode::OpenGeodeMeshException::test( vertex_id == 0 || vertex_id == 2, |
| 211 | "vertices_around_1 has wrong values." ); |
| 212 | } |
| 213 | const auto vertices_around_2 = edged_curve.vertices_around_vertex( 2 ); |
| 214 | geode::OpenGeodeMeshException::test( vertices_around_2.size() == 3, |
| 215 | "vertices_around_2 should have 3 vertex" ); |
no test coverage detected