Skip to content

Commit

Permalink
Added example for RawTetGenIO and holes
Browse files Browse the repository at this point in the history
  • Loading branch information
j-fu committed May 25, 2021
1 parent 86ffec3 commit b4f6630
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
34 changes: 34 additions & 0 deletions examples/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,40 @@ end



"""
cubewithhole(;vol=1)
Tetrahedralization of cube witn maximum tetrahedron volume.
"""
function cubewithhole(;vol=1)
input=TetGen.RawTetGenIO{Cdouble}()
outerpoints=[-1 -1 -1;
1 -1 -1;
1 1 -1;
-1 1 -1;
-1 -1 1;
1 -1 1;
1 1 1;
-1 1 1;]'

input.pointlist=hcat(outerpoints,outerpoints/2)

outerfacets=[1 2 3 4;
5 6 7 8;
1 2 6 5;
2 3 7 6;
3 4 8 7;
4 1 5 8;
]'

input.holelist=[0 0 0;]'

TetGen.facetlist!(input,hcat(outerfacets,outerfacets.+8))
tetrahedralize(input, "pQa$(vol)")
end



"""
cube_localref()
Expand Down
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ result = cube()
@test numberoftrifaces(result)==12
generic_test(result)

result = cubewithhole()
@test numberofpoints(result)==56
@test numberoftetrahedra(result)==168
@test numberofedges(result)==36
@test numberoftrifaces(result)==104
generic_test(result)


result = prism()
@test numberofpoints(result)==8
Expand Down

0 comments on commit b4f6630

Please sign in to comment.