<div dir="ltr"><div>Michael,<br><br></div>In case your interested in another example, there's also a quadtree in the "gloss-algorithms" [1] package.<br><br>[1]: <a href="http://hackage.haskell.org/package/gloss-algorithms">http://hackage.haskell.org/package/gloss-algorithms</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 20, 2015 at 1:41 PM, Tikhon Jelvis <span dir="ltr"><<a href="mailto:tikhon@jelv.is" target="_blank">tikhon@jelv.is</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Are you already familiar with lenses? From a glance at the code you linked, it will be hard to understand what's going on unless you are.<br><br></div>Personally, my advice is to implement a simple, limited quadtree yourself. The first part of "Functional Programming with QuadTrees"[1] is basically a tutorial on quadtrees with code in Miranda—eminently readable for Haskellers. That's where I would start: write up the code from their examples in Haskell, play around with it and add an extra function or two to understand what's going on.<br><br></div><div>Once you have an intuition for the underlying ideas, you can expand it to octtrees and more complex operations.<br></div><div><br>[1]: <a href="http://conal.net/papers/warren-burton/Functional%20Programming%20and%20Quadtrees.pdf" target="_blank">http://conal.net/papers/warren-burton/Functional%20Programming%20and%20Quadtrees.pdf</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Aug 20, 2015 at 1:30 PM, Michael Litchard <span dir="ltr"><<a href="mailto:michael@schmong.org" target="_blank">michael@schmong.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div><div><div><div><div><div>It looks like Octree is what I want if I can solve a particular problem. First let me articulate what I am looking for.<br><br></div>(1) Objects in 3-d space with no spatial extent. Collision is determined by two objects occupying the same point.'<br><br></div>(2) Efficient insert-delete-update<br><br></div>#2 seems to be the problem. I found this library, thankfully. I believe it's exactly what I am looking for, but for quadtrees.<br><br><a href="https://github.com/AshleyMoni/QuadTree" target="_blank">https://github.com/AshleyMoni/QuadTree</a><br><br></div>I'm a little overwhelmed as this is a new data structure for me. I believe if I can grok what is going on in this library, I can take these ideas and extend them to the octree. I'm referring specifically to this module<br><br><a href="https://github.com/AshleyMoni/QuadTree/blob/master/Data/QuadTree/Internal.hs" target="_blank">https://github.com/AshleyMoni/QuadTree/blob/master/Data/QuadTree/Internal.hs</a><br><br></div>And these functions<br><br>setLocation <span>::</span> <span>Eq</span> <span>a</span> <span>=></span> <span>Location</span> <span>-></span> <span>a</span> <span>-></span> <span>QuadTree</span> <span>a</span> <span>-></span> <span>QuadTree</span> <span>a</span>
      
      
        
        setLocation = set . atLocation<br><br></div>atLocation (Having difficulty cutting and pasting this to mail.)<br><br></div>I'd like to be able to visualize how the tree is being compressed, it may help to be able to see what happens to the tree when it's not compressed. <br><br></div>Does anyone have a pointer or advice in how to break this library down in parts to help me grok, in a way that will help me extend to octree? <br><div><div><div><br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br><br><br><br><br>
      
      
        
        <br>
      
      
        
                                  <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br>
      
      
        
        <br><br></div></div></div></div>
<br></div></div>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div>-- Michael Steele</div></div>
</div>