Translating a js script in gen


    Apr 08 2021 | 4:59 pm
    Hi, I'm trying to port in gen the behavior of the js script included in this patch. What I'm trying to achieve is to calculate the distance of all the particles in a system and to draw a segment between those particles that have a distance minor of a threshold
    The problem with js is related to an high framerate drop, so I'm searching some alternatives in terms of efficiency. I'm not a gen expert at all, so I'm not even sure if this is the best approach or even a feasible one. Thanks in advance Matteo

    • Apr 09 2021 | 3:59 pm
      without looking at your patch, I can say that I doubt very much porting to jit.gen will yield significant performance gains over JS. switching to a GPU process (e.g. via jit.gl.pix or GLSL via jit.gl.slab), may improve things. however in general these types of algorithms that require iterating several times over the the cells are not suitable for Gen processes. Instead optimizing your algorithms via partitioning structures (e.g. quadtree) is usually the way to go -

      Coding Challenge #98.1: Quadtree - Part 1