Skip to content

Commit c256ed4

Browse files
committed
add back old Syntax for Makie compat
1 parent 33a0b85 commit c256ed4

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/geometry_primitives.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ function _orthogonal_vector(::Type{VT}, vertices) where {VT <: VecTypes{3}}
165165
end
166166

167167
# Not sure how useful this fast path is, but it's simple to keep
168+
orthogonal_vector(p1::VT, p2::VT, p3::VT) where {VT <: VecTypes{3}} = _orthogonal_vector(Vec3f, to_ndim.(Vec3f, (p1, p2, p3), 0))
168169
function orthogonal_vector(::Type{VT}, triangle::Union{Triangle, NTuple{3, <:VecTypes}, StaticVector{3, <:VecTypes}}) where {VT <: VecTypes{3}}
169170
a, b, c = triangle
170171
return cross(to_ndim(VT, b-a, 0), to_ndim(VT, c-a, 0))

test/geometrytypes.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,10 @@ end
357357
t = Point2f[(0,0), (1,0), (2,1), (1,2), (0,2), (-1, 1)]
358358
@test GeometryBasics.orthogonal_vector(Vec3f, t) == Vec3f(0,0,8)
359359

360+
# Makie uses this syntax
361+
@test GeometryBasics.orthogonal_vector(Point3f(0), Point3f(1,0,1), Point3f(0,1,0)) == Vec3f(-1,0,1)
362+
@test GeometryBasics.orthogonal_vector((1,2,3), (2,3,1), (3,1,2)) == Vec3f(-3.0)
363+
360364
# Maybe the ::Any fallback is too generic...?
361365
struct TestType
362366
data::Vector{Vec3f}

0 commit comments

Comments
 (0)