Skip to content

Commit 2448713

Browse files
committed
bring back fast path for triangles
1 parent 202d37c commit 2448713

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/geometry_primitives.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,13 @@ function orthogonal_vector(::Type{VT},vertices) where VT
157157
return c
158158
end
159159

160-
function orthogonal_vector(vertices)
161-
return orthogonal_vector(eltype(vertices),vertices)
160+
# Not sure how useful this fast path is, but it's simple to keep
161+
function orthogonal_vector(::Type{VT}, triangle::Triangle) where {VT <: VecTypes{3}}
162+
a, b, c = triangle
163+
return cross(to_ndim(VT, b-a, 0), to_ndim(VT, c-a, 0))
162164
end
165+
end
166+
orthogonal_vector(vertices) = orthogonal_vector(Vec3f, vertices)
163167

164168
"""
165169
normals(positions::Vector{Point3{T}}, faces::Vector{<: NgonFace}[; normaltype = Vec3{T}])

0 commit comments

Comments
 (0)