Question: Converting data formatting

Hi,

I'm new here and was wondering if anyone could offer me some advice on some work I'm doing.  I've written some code in Maple to generate images of fundamental domains in Hyperbolic 3-space, but in order to get the necessary results, I have to do some convex hull calculations.  Currently I'm using qHull for this, which works well, but outputs its results in the form of a text file, reading in the following format:

3
6 8 12
     0      0      1
     0      0     -1
     2      0      0
     0      2      0
     2      2      1
     2      2     -1
3 2 1 0
3 1 3 0
3 4 2 0
3 3 4 0
3 1 5 3
3 5 1 2
3 4 5 2
3 5 4 3

My current method then involves pasting the relevant part of the information into another piece of code I've put together and running that  - however, this requires some tedious editing.  Specifically, of the above data, the stuff I actually need are the lines after the indented part, without the first digit in each case (which is a count of the number of entries in the line; it is not always 3), and seperated appropriately by lines.  For example, my code would require the above data to be reformatted into the following:

Output := [ [2,1,0] , [1,3,0] , [4,2,0] , [3,4,0] , [1,5,3] , [5,1,2] , [4,5,2] , [5,4,3]]

While this is obviously doable by hand, it's a bit tedious as the outputs become larger; not to mention more prone to errors.

Hence, I was wondering if anyone knew of any way of getting Maple to do this conversion automatically?  I've looked at the qHull output options and can't seem to find anything else useful, and being a (I think) DOS based program, providing an output in a text file, I'm doubtful I can change it from that end.

Alternatively, if anyone knows an alternative convex hull program that would give a more usefully formatted output, that'd also be great.  Or indeed if Maple can do it, which would be even easier - but from what I've seen in the help files (I'm using Maple 12) there's only a 2D convex hull option, and I'm looking at 3D data (note the data for the convex hull is in Euclidean geometry).

Any suggestions are greatly appreciated!  Thanks.

Please Wait...