Issue with Live Plotting 3D Objects using Meshes.jl, Observables, and GLMakie: Bound Error on Item Removal

ehsani63
Wed, 06 Mar 2024 17:39:39 +0000
Visualization

I’ve been exploring the use of Meshes.jl in combination with Observables and GLMakie for live plotting of 3D objects. My goal is to dynamically update a plot by adding or removing 3D objects (like Box or Ball) and visualize these changes in real-time. Adding new objects to the plot works seamlessly, but I encounter a BoundError whenever I try to remove an object from the observable vector. This issue seems specific to 3D systems, as I don’t face the same problem with 2D objects.

Here is a minimal code snippet that reproduces the situation:

using Meshes
using Observables
using GLMakie

rand_boxes = rand(Meshes.Box{3, Float64}, 10)
obs_boxes = Observable(rand_boxes)

# create the plot
viz(obs_boxes)

# Adding a new box works without any problem
b = Meshes.Box((0,0,0), (1, 1, 1))
push!(rand_boxes, b)
notify(obs_boxes)

# Removing an item results in an error
pop!(rand_boxes)
notify(obs_boxes)

Could anyone help me to understand what might be going wrong or point me towards a workaround or solution? Thank you in advance for your insights and assistance!

4 posts - 2 participants