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

`refine_rg` introduces boundary points into the interior

Open jlchan opened this issue 3 years ago • 4 comments

Love the package and am using it for a class, but I observed something odd aboutrefine_rg. I can usually extract boundary points using mesh.point_marker

using Plots
mesh = create_mesh(polygon_unitSquare(), quality_meshing=true, add_switches="penva0.05q") # switches
x,y = mesh.point[1,:],mesh.point[2,:]
scatter(x,y)
scatter!(x[mesh.point_marker .== 1],y[mesh.point_marker .== 1],leg=false,mark=:square,ms=3)

which gives the following Screen Shot 2021-04-15 at 3 16 51 PM

If I refine the mesh once using refine_rg

mesh = refine_rg(mesh)
x,y = mesh.point[1,:],mesh.point[2,:]
scatter(x,y)
scatter!(x[mesh.point_marker .== 1],y[mesh.point_marker .== 1],leg=false,mark=:square,ms=3)

mesh.point_marker seems to introduce extra interior boundary points. Screen Shot 2021-04-15 at 3 19 14 PM

I noticed that refine_rg does most of the setup in Julia - is it known why mesh.point_marker includes interior points in addition to boundary points?

jlchan avatar Apr 15 '21 20:04 jlchan

Dear @jlchan, I honestly don't remember since it is some time ago that I did some work on this mesh generator. You could have a look at what happens here.

Could of course be that there is a little bug. Please note that this is just an interface to a C-library and it is not very clean. If you could come up with a fix that would be great. I, unfortunately, will not have time to go into that.

Best, Konrad

konsim83 avatar Apr 16 '21 07:04 konsim83

Sure, I'll take a look. Thanks for the heads up!

jlchan avatar Apr 16 '21 16:04 jlchan

Sorry @jlchan for being not more helpful with that. I am recently more focused on other languages and I have moved away from triangular meshes

konsim83 avatar Apr 16 '21 17:04 konsim83

No problem, I understand that situation well! I've got some workarounds for it, so it's not pressing.

jlchan avatar Apr 16 '21 17:04 jlchan