Meshes.jl icon indicating copy to clipboard operation
Meshes.jl copied to clipboard

Add discretize method for Cylinder volume

Open stla opened this issue 2 years ago • 2 comments

Hello,

Running test() generates a stackoverflow error:

import Meshes

cylinder = Meshes.Cylinder((0,0,0), (1,1,1), 0.1)
sphere = Meshes.discretize(Meshes.Sphere((2,2,2), 0.1))

function test()
    Meshes.merge(cylinder, sphere)
end
julia> test()
ERROR: StackOverflowError:
Stacktrace:
     [1] simplexify(geometry::Meshes.Cylinder{Float64})
       @ Meshes C:\Users\sdl96354\.julia\packages\Meshes\uPQGa\src\discretization.jl:130
     [2] discretize(geometry::Meshes.Cylinder{Float64})
       @ Meshes C:\Users\sdl96354\.julia\packages\Meshes\uPQGa\src\discretization.jl:103
--- the last 2 lines are repeated 39990 more times ---
 [79983] simplexify(geometry::Meshes.Cylinder{Float64})
       @ Meshes C:\Users\sdl96354\.julia\packages\Meshes\uPQGa\src\discretization.jl:130

stla avatar Oct 11 '23 12:10 stla

You are trying to merge a 3D volume with a 2D surface. You probably want CylinderSurface instead of Cylinder.

In any case, we should probably fix our merge method to accept meshes of different parametric dimension.

juliohm avatar Oct 11 '23 13:10 juliohm

We don't have a method to discretize the Cylinder volume yet. It should be easy to add a method to RegularSampling and then a method to RegularDiscretization, similar to what we do with CylinderSurface.

juliohm avatar Oct 11 '23 22:10 juliohm

Closing in favor of #890

juliohm avatar Jun 14 '24 14:06 juliohm