Last active
March 30, 2016 16:49
-
-
Save stephanmg/770ca05f6d9ef49b8b02dfd3e33dfe02 to your computer and use it in GitHub Desktop.
Tetrahedralize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool test_tetgen() { | |
/// grid management | |
Grid g; | |
ug::SubsetHandler sh(g); | |
g.attach_to_vertices(ug::aPosition); | |
ug::Grid::VertexAttachmentAccessor<ug::APosition3> aaPos(g, ug::aPosition); | |
/// unit cube | |
ug::RegularVertex* temp1 = *g.create<ug::RegularVertex>(); | |
ug::RegularVertex* temp2 = *g.create<ug::RegularVertex>(); | |
ug::RegularVertex* temp3 = *g.create<ug::RegularVertex>(); | |
ug::RegularVertex* temp4 = *g.create<ug::RegularVertex>(); | |
ug::RegularVertex* temp5 = *g.create<ug::RegularVertex>(); | |
ug::RegularVertex* temp6 = *g.create<ug::RegularVertex>(); | |
ug::RegularVertex* temp7 = *g.create<ug::RegularVertex>(); | |
ug::RegularVertex* temp8 = *g.create<ug::RegularVertex>(); | |
/// bottom verts | |
aaPos[temp1] = ug::vector3(0, 0, 0); | |
aaPos[temp2] = ug::vector3(0, 1, 0); | |
aaPos[temp3] = ug::vector3(1, 0, 0); | |
aaPos[temp5] = ug::vector3(1, 1, 0); | |
/// top verts | |
aaPos[temp4] = ug::vector3(1, 1, 1); | |
aaPos[temp6] = ug::vector3(0, 0, 1); | |
aaPos[temp7] = ug::vector3(0, 1, 1); | |
aaPos[temp8] = ug::vector3(1, 0, 1); | |
/// assign to subset | |
sh.assign_subset(temp1, 1); | |
sh.assign_subset(temp2, 1); | |
sh.assign_subset(temp3, 1); | |
sh.assign_subset(temp4, 1); | |
sh.assign_subset(temp5, 1); | |
sh.assign_subset(temp6, 1); | |
sh.assign_subset(temp7, 1); | |
sh.assign_subset(temp8, 1); | |
/// tetrahedralize | |
return Tetrahedralize(g, sh, 0, false, false, ug::aPosition, 10); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment