JuliaGeometry / Meshes.jl

Computational geometry in Julia
https://juliageometry.github.io/MeshesDocs/stable
Other
394 stars 85 forks source link

Allow spacing with mixed units in `CartesianGrid` #921

Closed juliohm closed 3 months ago

juliohm commented 3 months ago

MWE:

julia> using Meshes
julia> using Unitful: m, ft

julia> CartesianGrid((0m, 0m, 0m), (100m, 100m, 100m), (1ft, 1ft, 1ft))
329×329×329 CartesianGrid
├─ minimum: Point(x: 0.0 m, y: 0.0 m, z: 0.0 m)
├─ maximum: Point(x: 100.2792 m, y: 100.2792 m, z: 100.2792 m)
└─ spacing: (1.0 ft, 1.0 ft, 1.0 ft)

julia> CartesianGrid((0m, 0m, 0m), (100m, 100m, 100m), (1m, 1m, 1ft))
ERROR: MethodError: no method matching CartesianGrid(::Tuple{…}, ::Tuple{…}, ::Tuple{…})

Closest candidates are:
  CartesianGrid(::Tuple{Vararg{T, Dim}} where T, ::Tuple{Vararg{T, Dim}} where T; dims) where Dim
   @ Meshes ~/.julia/dev/Meshes/src/mesh/cartesiangrid.jl:114
  CartesianGrid(::Tuple{Vararg{T, Dim}} where T, ::Tuple{Vararg{T, Dim}} where T, ::Tuple{Vararg{T, Dim}} where T) where Dim
   @ Meshes ~/.julia/dev/Meshes/src/mesh/cartesiangrid.jl:104
  CartesianGrid(::Tuple{Vararg{Int64, Dim}}, ::Tuple{Vararg{T, Dim}} where T, ::Tuple{Vararg{T, Dim}} where T) where Dim
   @ Meshes ~/.julia/dev/Meshes/src/mesh/cartesiangrid.jl:87
  ...

Stacktrace:
 [1] top-level scope
   @ REPL[8]:1
Some type information was truncated. Use `show(err)` to see complete types.