TetGen.jl icon indicating copy to clipboard operation
TetGen.jl copied to clipboard

TetGen doesn't work for triangular input surfaces?

Open Kevin-Mattheus-Moerman opened this issue 9 months ago • 3 comments

Based on the cube (quad) mesh example provided in the README, I've just tried to apply this to triangular boundary surfaces. E.g. like this:

F = TriangleFace{Cint}[TriangleFace(1, 2, 3), TriangleFace(4, 2, 1), TriangleFace(4, 3, 2), TriangleFace(4, 1, 3)]
V = Point{3, Float64}[[-0.8164965809277261, -0.47140452079103173, -0.3333333333333333], [0.8164965809277261, -0.47140452079103173, -0.3333333333333333], [0.0, 0.0, 1.0], [0.0, 0.9428090415820635, -0.3333333333333333]]
markers = Cint[-1, -2, 0, 0]

mesh = GeometryBasics.Mesh(V, meta(F, markers=markers))
result = tetrahedralize(mesh, "vpq1.414a0.1")

However, I get the following error:

ERROR: MethodError: no method matching unsafe_array_convert(::Type{Ptr{…}}, ::StructArrays.StructVector{GeometryBasics.NgonFaceMeta{…}, @NamedTuple{…}, Int64})

Closest candidates are:
  unsafe_array_convert(::Type{Ptr{T}}, ::Vector{T}) where T
   @ TetGen ~/.julia/packages/TetGen/QKVpk/src/jltetgenio.jl:251
  unsafe_array_convert(::Type{Ptr{T1}}, ::Vector{T2}) where {T1, T2}
   @ TetGen ~/.julia/packages/TetGen/QKVpk/src/jltetgenio.jl:255
  unsafe_array_convert(::Type{Ptr{TetGen.CFacet{T}}}, ::Tuple{Vector{F}, Vector{TetGen.CPolygon}, Array{TetGen.CFacet{T}, 1}}) where {F, T}
   @ TetGen ~/.julia/packages/TetGen/QKVpk/src/jltetgenio.jl:246
  ...
Stacktrace:
 [1] cconvert(CIO::Type{…}, obj::TetGen.JLTetGenIO{…})
   @ TetGen ~/.julia/packages/TetGen/QKVpk/src/jltetgenio.jl:293
 [2] tetrahedralize(input::TetGen.JLTetGenIO{Float64, 4, 0, 0, Int64, StructArrays.StructVector{…}}, command::String)
   @ TetGen ~/.julia/packages/TetGen/QKVpk/src/jltetgenio.jl:314
 [3] tetrahedralize(mesh::GeometryBasics.Mesh{3, Float64, GeometryBasics.Ngon{…}, FaceView{…}}, command::String)
   @ TetGen ~/.julia/packages/TetGen/QKVpk/src/api.jl:39
 [4] top-level scope
   @ ~/DATA/Julia/comodo_wip/wip/temp_use_TetGen.jl:37
Some type information was truncated. Use `show(err)` to see complete types.

Any help resolving this would be appreciated, thanks.

Kevin-Mattheus-Moerman avatar May 23 '24 09:05 Kevin-Mattheus-Moerman