Skip to content

Commit 04f7dd8

Browse files
committed
feat(TetrahedralSolid): adding polyhedron_edges() function, to return 6 polyhedron facet edges
1 parent 9008f31 commit 04f7dd8

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

include/geode/mesh/core/tetrahedral_solid.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ namespace geode
6767
[[nodiscard]] PolyhedronEdgesVertices polyhedron_edges_vertices(
6868
index_t polyhedron ) const final;
6969

70+
[[nodiscard]] std::array< PolyhedronFacetEdge, 6 > polyhedron_edges(
71+
index_t polyhedron ) const;
72+
7073
[[nodiscard]] PolyhedronFacetsVertices polyhedron_facets_vertices(
7174
index_t polyhedron ) const final;
7275

src/geode/mesh/core/tetrahedral_solid.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,34 @@ namespace geode
404404
return result;
405405
}
406406

407+
template < index_t dimension >
408+
std::array< PolyhedronFacetEdge, 6 >
409+
TetrahedralSolid< dimension >::polyhedron_edges(
410+
index_t polyhedron ) const
411+
{
412+
std::array< PolyhedronFacetEdge, 6 > result;
413+
const auto vertices = this->polyhedron_vertices( polyhedron );
414+
result[0] = this->polyhedron_facet_edge_from_vertices(
415+
{ vertices[0], vertices[1] }, polyhedron )
416+
.value();
417+
result[1] = this->polyhedron_facet_edge_from_vertices(
418+
{ vertices[0], vertices[2] }, polyhedron )
419+
.value();
420+
result[2] = this->polyhedron_facet_edge_from_vertices(
421+
{ vertices[0], vertices[3] }, polyhedron )
422+
.value();
423+
result[3] = this->polyhedron_facet_edge_from_vertices(
424+
{ vertices[1], vertices[2] }, polyhedron )
425+
.value();
426+
result[4] = this->polyhedron_facet_edge_from_vertices(
427+
{ vertices[1], vertices[3] }, polyhedron )
428+
.value();
429+
result[5] = this->polyhedron_facet_edge_from_vertices(
430+
{ vertices[2], vertices[3] }, polyhedron )
431+
.value();
432+
return result;
433+
}
434+
407435
template < index_t dimension >
408436
PolyhedronFacets TetrahedralSolid< dimension >::polyhedron_vertex_facets(
409437
const PolyhedronVertex& polyhedron_vertex ) const

0 commit comments

Comments
 (0)