Skip to content

Commit 98ab606

Browse files
committed
Fix type instability in normals
1 parent bd1c20d commit 98ab606

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/geometry_primitives.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ Compute all vertex normals.
107107
"""
108108
function normals(vertices::AbstractVector{<:AbstractPoint{3,T}}, faces::AbstractVector{F};
109109
normaltype=Vec{3,T}) where {T,F<:NgonFace}
110-
normals_result = zeros(normaltype, length(vertices)) # initilize with same type as verts but with 0
110+
return normals(vertices, faces, normaltype)
111+
end
112+
113+
function normals(vertices::AbstractVector{<:AbstractPoint{3,T}}, faces::AbstractVector{F},
114+
::Type{N}) where {T,F<:NgonFace,N}
115+
normals_result = zeros(N, length(vertices)) # initilize with same type as verts but with 0
111116
for face in faces
112117
v = metafree.(vertices[face])
113118
# we can get away with two edges since faces are planar.

0 commit comments

Comments
 (0)