Skip to content

Commit 036f609

Browse files
Merge pull request #988 from Geode-solutions/fix/order-of-vertices-in-hybrid-conversion
fix(ConvertSolidMesh): changes how to get pyramid vertices
2 parents dca4061 + e3b1eae commit 036f609

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/geode/mesh/helpers/convert_solid_mesh.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ namespace
169169
const auto first_polyhedron_facet_vertices =
170170
solid.polyhedron_facet_vertices( { hexahedron_id, 0 } );
171171
ordered_vertices[0] = first_polyhedron_facet_vertices[0];
172-
ordered_vertices[1] = first_polyhedron_facet_vertices[3];
172+
ordered_vertices[1] = first_polyhedron_facet_vertices[1];
173173
ordered_vertices[2] = first_polyhedron_facet_vertices[2];
174-
ordered_vertices[3] = first_polyhedron_facet_vertices[1];
174+
ordered_vertices[3] = first_polyhedron_facet_vertices[3];
175175
for( const auto f : geode::LRange( 1, 6 ) )
176176
{
177177
const auto polyhedron_facet_vertices =

tests/mesh/test-convert-solid.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <geode/mesh/core/hybrid_solid.hpp>
3434
#include <geode/mesh/core/light_regular_grid.hpp>
3535
#include <geode/mesh/core/regular_grid_solid.hpp>
36+
#include <geode/mesh/core/solid_edges.hpp>
3637
#include <geode/mesh/core/tetrahedral_solid.hpp>
3738
#include <geode/mesh/helpers/detail/split_along_solid_facets.hpp>
3839
#include <geode/mesh/io/hybrid_solid_output.hpp>
@@ -112,18 +113,18 @@ void test_hybrid_solid()
112113
builder_hex->create_point( point );
113114
}
114115
builder_hex->create_polyhedron( { 0, 1, 2, 3, 4, 5, 6, 7 },
115-
{ { 0, 2, 3, 1 }, { 0, 4, 5, 1 }, { 3, 1, 5, 7 }, { 4, 6, 7, 5 },
116+
{ { 0, 1, 3, 2 }, { 0, 4, 5, 1 }, { 3, 1, 5, 7 }, { 4, 6, 7, 5 },
116117
{ 2, 3, 7, 6 }, { 0, 2, 6, 4 } } );
117118
auto hybrid_solid_hex = geode::convert_solid_mesh_into_hybrid_solid( *hex );
118119
geode::save_hybrid_solid(
119120
*hybrid_solid_hex.value(), "hybrid_solid_hex.og_hso3d" );
120121
std::vector< geode::Point3D > prism_points{
121122
geode::Point3D{ { 0, 0, 0 } },
122123
geode::Point3D{ { 1, 0, 0 } },
123-
geode::Point3D{ { 0, 1, 0 } },
124+
geode::Point3D{ { 0.5, 1, 0 } },
124125
geode::Point3D{ { 0, 0, 1 } },
125126
geode::Point3D{ { 1, 0, 1 } },
126-
geode::Point3D{ { 0, 1, 1 } },
127+
geode::Point3D{ { 0.5, 1, 1 } },
127128
};
128129
auto prism = geode::SolidMesh3D::create();
129130
auto builder_prism = geode::SolidMeshBuilder3D::create( *prism );
@@ -132,8 +133,8 @@ void test_hybrid_solid()
132133
builder_prism->create_point( point );
133134
}
134135
builder_prism->create_polyhedron(
135-
{ 0, 1, 2, 3, 4, 5 }, { { 0, 2, 1 }, { 3, 5, 4 }, { 0, 3, 4, 1 },
136-
{ 0, 3, 5, 2 }, { 1, 4, 5, 2 } } );
136+
{ 0, 1, 2, 3, 4, 5 }, { { 0, 1, 2 }, { 3, 5, 4 }, { 0, 3, 4, 1 },
137+
{ 0, 2, 5, 3 }, { 1, 4, 5, 2 } } );
137138
auto hybrid_solid_prism =
138139
geode::convert_solid_mesh_into_hybrid_solid( *prism );
139140
geode::save_hybrid_solid(
@@ -148,8 +149,8 @@ void test_hybrid_solid()
148149
builder_pyramid->create_point( point );
149150
}
150151
builder_pyramid->create_polyhedron(
151-
{ 0, 1, 2, 3, 4 }, { { 0, 4, 1 }, { 0, 4, 3 }, { 1, 4, 2 }, { 4, 3, 2 },
152-
{ 0, 3, 2, 1 } } );
152+
{ 0, 1, 2, 3, 4 }, { { 0, 4, 1 }, { 3, 4, 0 }, { 1, 4, 2 }, { 4, 3, 2 },
153+
{ 0, 1, 2, 3 } } );
153154
auto hybrid_solid_pyramid =
154155
geode::convert_solid_mesh_into_hybrid_solid( *pyramid );
155156
geode::save_hybrid_solid(

0 commit comments

Comments
 (0)