@@ -82,7 +82,7 @@ function Base.show(io::IO, x::NgonFace{N, T}) where {N, T}
8282end
8383
8484# two faces are the same if they match or they just cycle indices
85- function Base.:( == ) (f1:: FT , f2:: FT ) where {N, FT <: AbstractFace{N} }
85+ function cyclic_equal (f1:: FT , f2:: FT ) where {N, FT <: AbstractFace{N} }
8686 _, min_i1 = findmin (f1. data)
8787 _, min_i2 = findmin (f2. data)
8888 @inbounds for i in 1 : N
@@ -92,7 +92,7 @@ function Base.:(==)(f1::FT, f2::FT) where {N, FT <: AbstractFace{N}}
9292 end
9393 return true
9494end
95- function Base . hash (f:: AbstractFace{N} , h:: UInt ) where {N}
95+ function cyclic_hash (f:: AbstractFace{N} , h:: UInt = hash ( 0 ) ) where {N}
9696 _, min_i = findmin (f. data)
9797 @inbounds for i in min_i: N
9898 h = hash (f[i], h)
@@ -102,17 +102,16 @@ function Base.hash(f::AbstractFace{N}, h::UInt) where {N}
102102 end
103103 return h
104104end
105- Base. isequal (f1:: AbstractFace , f2:: AbstractFace ) = == (f1, f2)
106105
107106# Fastpaths
108- Base.:( == ) (f1:: FT , f2:: FT ) where {FT <: AbstractFace{2} } = minmax (f1. data... ) == minmax (f2. data... )
109- Base . hash (f:: AbstractFace{2} , h:: UInt ) = hash (minmax (f. data... ), h)
107+ cyclic_equal (f1:: FT , f2:: FT ) where {FT <: AbstractFace{2} } = minmax (f1. data... ) == minmax (f2. data... )
108+ cyclic_hash (f:: AbstractFace{2} , h:: UInt = hash ( 0 ) ) = hash (minmax (f. data... ), h)
110109
111- function Base.:( == ) (f1:: FT , f2:: FT ) where {FT <: AbstractFace{3} }
110+ function cyclic_equal (f1:: FT , f2:: FT ) where {FT <: AbstractFace{3} }
112111 return (f1. data == f2. data) || (f1. data == (f2[2 ], f2[3 ], f2[1 ])) ||
113112 (f1. data == (f2[3 ], f2[1 ], f2[2 ]))
114113end
115- function Base . hash (f:: AbstractFace{3} , h:: UInt )
114+ function cyclic_hash (f:: AbstractFace{3} , h:: UInt = hash ( 0 ) )
116115 if f[1 ] < f[2 ]
117116 if f[1 ] < f[3 ]
118117 return hash (f. data, h)
0 commit comments