Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/geometry_primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ collect_with_eltype(::Type{T}, vec::Vector{T}) where {T} = vec
collect_with_eltype(::Type{T}, vec::AbstractVector{T}) where {T} = collect(vec)

function collect_with_eltype(::Type{T}, iter) where {T}
isempty(iter) && return T[]
# We need to get `eltype` information from `iter`, it seems to be `Any`
# most of the time so the eltype checks here don't actually work
l = if Base.IteratorSize(iter) isa Union{Base.HasShape,Base.HasLength}
if Base.IteratorEltype(iter) isa Base.HasEltype && isconcretetype(eltype(iter))
# Work out the exact length
# Work out the exact length
length(convert_simplex(T, first(iter))) * length(iter)
else
# We know it is at least the length of iter,
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,8 @@ end
end

@testset "decompose/triangulation" begin
@test isempty(decompose(Vec3f, []))
@test decompose(Vec3f, []) isa Vector{Vec3f}
primitive = Sphere(Point3f(0), 1)
@test ndims(primitive) === 3
mesh = triangle_mesh(primitive)
Expand Down