Skip to content

Commit

Permalink
Fixed error in testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-Mattheus-Moerman committed Apr 20, 2024
1 parent 8ed7425 commit 75fcb1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/demo_vertexnormal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ for q=1:1:4
M = load(fileName_mesh)

# Obtain mesh faces and vertices
F = faces(M)
F = tofaces(faces(M))
V = topoints(coordinates(M))
F,V,_ = mergevertices(F,V)
M = GeometryBasics.Mesh(V,F)
Expand Down
6 changes: 3 additions & 3 deletions src/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ defined by `F`. The input `F` can either represent a vector of faces or a
GeometryBasics mesh.
"""
function meshedges(F::Array{NgonFace{N,T},1}; unique_only=false) where N where T<:Integer
E = LineFace{T}[]
E = LineFace{Int64}[]
for j1 in 1:N # Loop over each node/point for the current simplex
if j1<N
j2 = j1+1
Expand Down Expand Up @@ -2143,8 +2143,8 @@ function normalplot(ax,F::Vector{NgonFace{N,TF}},V::Vector{Point{ND,TV}}; type_f
end

function normalplot(ax,M::GeometryBasics.Mesh; type_flag=:face, color=:black,linewidth=3,scaleval=nothing)
F = faces(M)
V = coordinates(M)
F = tofaces(faces(M))
V = topoints(coordinates(M))
return normalplot(ax,F,V;type_flag=type_flag, color=color,linewidth=linewidth,scaleval=scaleval)
end

Expand Down
11 changes: 8 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2874,15 +2874,20 @@ end
@test length(faces(Mp)) == length(V)

fileName_mesh = joinpath(comododir(),"assets","obj","spot_control_mesh.obj")
M = load(fileName_mesh)
F = faces(M)
V = topoints(coordinates(M))
Mn = load(fileName_mesh)
F = tofaces(faces(Mn))
V = topoints(coordinates(Mn))

hp1 = normalplot(ax,F,V; type_flag=:vertex, color=:black,linewidth=3,scaleval=nothing)
Mp = hp1[1].val
@test typeof(hp1) == Wireframe{Tuple{GeometryBasics.Mesh{3, Float32, Line{3, Float32}, SimpleFaceView{3, Float32, 2, Int64, Point3{Float32}, LineFace{Int64}}}}}
@test length(faces(Mp)) == length(V)

hp1 = normalplot(ax,Mn; type_flag=:face)
Mp = hp1[1].val
@test typeof(hp1) == Wireframe{Tuple{GeometryBasics.Mesh{3, Float32, Line{3, Float32}, SimpleFaceView{3, Float32, 2, Int64, Point3{Float32}, LineFace{Int64}}}}}
@test length(faces(Mp)) == length(F)

# Not supported yet
# hp1 = normalplot(ax,F,V; type_flag=:vertex, color=:black,linewidth=3,scaleval=nothing)
# Mp = hp1[1].val
Expand Down

0 comments on commit 75fcb1c

Please sign in to comment.