Can I put non-primitive geometries into a GeometrySet?

Jfschue
Wed, 09 Oct 2024 10:07:58 +0000
General Usage

If I put a SimpleMesh geometry into a GeometrySet, I get a StackOverflowError:

using Meshes

# test using primitive geometries
s1 = Meshes.Sphere((0, 0, 0), 1)
s2 = Meshes.Sphere((1, 1, 1), 1)
gs1 = GeometrySet([s1, s2]) # works fine

# test using Meshes
s3 = discretize(s1, RegularDiscretization(10, 10))
s4 = discretize(s2, RegularDiscretization(10, 10))
gs2 = GeometrySet([s3, s4]) # throws StackOverflowError

StackOverflowError:

Stacktrace:
  [1] _stable_typeof
    @ ./operators.jl:910 [inlined]
  [2] Base.Fix2(f::typeof(isequal), x::Type)
    @ Base ./operators.jl:1121
  [3] isequal
    @ ./operators.jl:1136 [inlined]
  [4] allequal
    @ ./set.jl:533 [inlined]
  [5] GeometrySet(geoms::Vector{SimpleMesh{𝔼{3}, Cartesian3D{NoDatum, Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}, Vector{Meshes.Point{𝔼{3}, Cartesian3D{NoDatum, Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}}}, SimpleTopology{Connectivity}}})
    @ Meshes ~/.julia/packages/Meshes/fFipW/src/domains/sets.jl:29
  [6] GeometrySet(geoms::Vector{SimpleMesh{𝔼{3}, Cartesian3D{NoDatum, Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}, Vector{Meshes.Point{𝔼{3}, Cartesian3D{NoDatum, Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}}}, SimpleTopology{Connectivity}}}) (repeats 74533 times)
    @ Meshes ~/.julia/packages/Meshes/fFipW/src/domains/sets.jl:35
  [7] eval
    @ ./boot.jl:370 [inlined]
  [8] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1903
...

Thoughts, suggestions? I’m new to Meshes.jl, so very possibly doing something stupid. I am headed in this direction (meshes in GeometrySets) because ultimately I want to save multiple geometries into an OBJ or PLY file and it seems like using a geotable and GeoIO would be a convenient way to do that.

Many thanks!

I’m using Julia 1.9.2 and Meshes.jl 0.51.19

9 posts - 3 participants