Skip to content

Commit 879a95b

Browse files
Rename variable CCW => DIR to avoid confusion
The code/algorithm doesn't actually check for counter-clockwise-ness, it only knows whether something has an inconsistent orientation with previously added elements (ultimately going back to whichever element was added first--whose orientation was never checked)
1 parent 6e60238 commit 879a95b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/topologies/halfedge.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ function HalfEdgeTopology(elems::AbstractVector{<:Connectivity}; sort=true)
171171
eleminds = sort ? indexin(adjelems, elems) : 1:length(elems)
172172

173173
# start assuming that all elements are
174-
# oriented consistently as CCW
175-
CCW = trues(length(adjelems))
174+
# oriented consistently
175+
REV_DIR = falses(length(adjelems))
176176

177177
# initialize with first element
178178
half4pair = Dict{Tuple{Int,Int},HalfEdge}()
@@ -210,12 +210,12 @@ function HalfEdgeTopology(elems::AbstractVector{<:Connectivity}; sort=true)
210210
end
211211

212212
if any_claimed_edges_exist(inds, half4pair)
213-
CCW[e] = false
213+
REV_DIR[e] = true
214214
end
215215

216216
ei = eleminds[e]
217-
if !CCW[e]
218-
# reinsert pairs in CCW orientation
217+
if REV_DIR[e]
218+
# insert pairs in consistent orientation
219219
for i in eachindex(inds)
220220
u = inds[i]
221221
u1 = inds[mod1(i + 1, n)]
@@ -254,7 +254,7 @@ function HalfEdgeTopology(elems::AbstractVector{<:Connectivity}; sort=true)
254254
halves = Vector{Tuple{HalfEdge,HalfEdge}}()
255255
visited = Set{Tuple{Int,Int}}()
256256
for (e, inds) in enumerate(adjelems)
257-
inds = CCW[e] ? inds : reverse(inds)
257+
inds = REV_DIR[e] ? reverse(inds) : inds
258258
n = length(inds)
259259
for i in eachindex(inds)
260260
vi = inds[i]

0 commit comments

Comments
 (0)