Skip to content
This repository was archived by the owner on Nov 22, 2023. It is now read-only.

Commit 9caec85

Browse files
authored
Merge pull request #91 from rdeits/fix-mesh-convert
Fix mesh conversion
2 parents f723542 + bec418f commit 9caec85

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/meshes.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function all_attributes{M <: HMesh}(m::M)
4848
end
4949

5050
# Needed to not get into an stack overflow
51-
convert{M <: AbstractMesh}(::Type{M}, mesh::AbstractGeometry) = M(mesh)
51+
convert{M <: AbstractMesh}(::Type{M}, mesh::Union{AbstractGeometry, AbstractMesh}) = M(mesh)
5252
convert(::Type{T}, mesh::T) where T <: AbstractMesh = mesh
5353
# (::Type{HM1}){HM1 <: AbstractMesh}(mesh::HM1) = mesh
5454

test/meshes.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ end
156156
@test all(isapprox.(ns, expect))
157157
end
158158

159+
@testset "conversion" begin
160+
VT = vertextype(GLNormalMesh)
161+
FT = facetype(GLNormalMesh)
162+
vs = [VT(0., 0, 0), VT(1., 0, 0), VT(0., 1, 0)]
163+
fs = [FT(1, 2, 3)]
164+
mesh = PlainMesh{eltype(VT), FT}(vertices=vs, faces=fs)
165+
@test convert(GLNormalMesh, mesh) == GLNormalMesh(vs, fs)
166+
end
167+
159168
end
160169

161170

0 commit comments

Comments
 (0)