#!/usr/bin/python
import sys
from subprocess import call

# For a fixup_factor of 100, (leaving in the -J), I'm still getting wireframe stuff.
# with 1000, it is _much_ better, but there is some extranious noise in the
# output.  1500 still has a little noise along some edges.  1700 has a few
# pixels of noise.
# With 2000, it looks perfect.
fixup_factor = 2000
def main(args):
    sys.stderr.write('called with %r\n' % args)
    for i, arg in enumerate(args):
        if arg.startswith('-ca'):
            args[i] = '-ca%0.1f' % (float(arg[3:]) * fixup_factor)
        elif arg.startswith('-cg'):
            parts = arg.split(',')
            parts[-1] = '%0.1f' % (float(parts[-1]) / fixup_factor)
            args[i] = ','.join(parts)
    sys.stderr.write('changed to %r\n' % args)
    call(['ldglite',] + args)

if __name__ == '__main__':
    main(sys.argv[1:])
