Skip to content

Breaking behaviour change relating to using Boolean operations on faces #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Kevin-Mattheus-Moerman opened this issue Mar 13, 2025 · 0 comments · Fixed by #246
Closed

Comments

@Kevin-Mattheus-Moerman
Copy link
Contributor

Kevin-Mattheus-Moerman commented Mar 13, 2025

@ffreyer I can use something like the below to find the indices of points part of a face not equal to some value (the indices of the other points, this is handy e.g. to find which points of a face do not touch a point of something else).

f = QuadFace{Int64}(1,2,3,4) # Some face
indicesOther = f[f.!=3] 

For my project, when my compat features GeometryBasics = "0.3, 0.4", the use of f[f.!=3] returns:

3-element Vector{Int64}:
 1
 2
 4

This is the desired/expected behaviour, i.e. I can use the boolean f.!=3 to grab the indices that are not 3.

However, when my compat features GeometryBasics = "0.5", the use of f[f.!=3] returns:

ERROR: ArgumentError: invalid index: true of type Bool
Stacktrace:
 [1] to_index(i::Bool)
   @ Base ./indices.jl:308
 [2] to_index(A::TriangleFace{Int64}, i::Bool)
   @ Base ./indices.jl:292
 [3] to_indices
   @ ./indices.jl:368 [inlined]
 [4] to_indices
   @ ./indices.jl:365 [inlined]
 [5] getindex
   @ ./abstractarray.jl:1312 [inlined]
 [6] (::GeometryBasics.var"#51#52"{TriangleFace{Int64}})(i::Bool)
   @ GeometryBasics ~/.julia/packages/GeometryBasics/79wKA/src/basic_types.jl:39
 [7] map
   @ ./tuple.jl:357 [inlined]
 [8] getindex(elements::TriangleFace{Int64}, face::TriangleFace{Bool})
   @ GeometryBasics ~/.julia/packages/GeometryBasics/79wKA/src/basic_types.jl:39
 [9] top-level scope
   @ REPL[7]:1

So this is braking behaviour of course. Is this something you will be able to address or do I need to alter my code?

Separately I should add that in both instances above (both for early versions and the latest version of GeometryBasics) I find this behaviour odd, i.e. that f.!=3 returns a face containing Bools, that is never a valid/useful thing I'd say. So perhaps this should return some kind of vector of Bool entries instead? I'd say making that change would solve the above too.

f.!=3

4-element QuadFace{Bool} with indices SOneTo(4):
 1
 1
 0
 1

Let me know if you need any more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant