I am trying to do read/write of a simple Wavefront .obj file without triangulation.
However, the following will result in an error.
julia> using GeometryBasics # v0.4.10
julia> vertices = Point3f[(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0), (0, 0, 1)];
julia> faces = [QuadFace(1, 2, 3, 4), TriangleFace(5, 2, 1)];
julia> Mesh(vertices, faces)
ERROR: MethodError: no method matching Polytope(::Type{Point{3, Float32}}, ::Type{NgonFace{S, Int64} where S})
julia> VERSION
v"1.10.2"
The construction will succeed if the type is sufficiently qualified as follows:
using GeometryBasics
import GeometryBasics.Ngon
TQFace = Union{TriangleFace{Int},QuadFace{Int}}
TQNgon = Union{Triangle{3,Float32}, Ngon{3,Float32,4,Point3f}}
vertices = Point3f[(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0), (0, 0, 1)]
tqfaces = TQFace[QuadFace(1, 2, 3, 4), TriangleFace(5, 2, 1)]
faceview = FaceView{TQNgon,Point3f,TQFace,Vector{Point3f},Vector{TQFace}}(vertices, tqfaces); # `show` throws an error
mesh = Mesh(faceview); # `show` throws an error
julia> faces(mesh) # seems to be working
2-element Vector{Union{TriangleFace{Int64}, QuadFace{Int64}}}:
[1, 2, 3, 4]
TriangleFace(5, 2, 1)
Are there additional packages that would be useful for this use case?