Skip to content

Commit 3595616

Browse files
authored
Merge pull request #98 from mtsch/fix-normals-type-instability
Fix type instability in normals
2 parents bd1c20d + 9e5f396 commit 3595616

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/geometry_primitives.jl

+6-1
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))
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)