in reply to Re: AoA data merging
in thread AoA data merging

This is similar to some of my own attempts, and it does run after a few minor fixes (missing a ] bracket on the first if, replacing 'continue' with 'next'), but this attempt has an unusual bug that I can't quite identify that makes it impossible to call it iteratively. The source data contains ten arrayrefs, if you run that array through this function, the return value succesfully merges those ten sections into five, so it worked, but that isn't all the return data contains, it also contains thirty-one copies of those five elements. The second iteration will contain the same five merged elements, along with 625 copies. The third iteration will have 198,130 copies, since my actual source data may contain thousands of points, you can imagine this has a negative impact on memory consumption. :)

As for your other concerns, the actual code does deal with floats in a reasonable manner, and I have other code in another part of the application that checks to make sure I don't have multiple segments with the same starting or ending point.

Replies are listed 'Best First'.
Re: Re: Re: AoA data merging
by rjray (Chaplain) on Mar 11, 2003 at 23:45 UTC

    I've tweaked the code a bit (the fixes you point out, and a change to keep the current node under consideration until such point as it gets sent to @final). But I don't think that my tweaks will solve the problems you describe. Have you created a test application with reasonable data that you could send to me to run myself? Something minimalist, like in the original node?

    If so, feel free to email it to me at "rjray at blackperl.com".

    --rjray

      The code contained in the original node is my test application, if you take the @data declaration, the merge sub, and the Point package, and put them in a file, all you need to add to get it to run is:

      #!/usr/bin/perl -w use strict; use Data::Dumper; # @data declaration here splice(@data,7,1); print Dumper(merge(@data)); # merge sub here # point class declaration here

      But see the node I just posted for a working implementation.