Pylogram cartoons
Aug. 1st, 2012 11:23 amI implemented what I wanted arrays for, in order to be able to draw simple stick figures, where you can specify the number of panels and the number and size of figures per panel and it auto-generates it.
Image of example output:
https://github.com/CartesianDaemon/pylogram/blob/master/cartoonstrip.png
( Example image )
Source for example:
https://github.com/CartesianDaemon/pylogram/blob/master/example_cartoonstrip.py
It also involved tidying up the constrain solver so instead of solving everything at the end, it normalises the constraints as they're applied, which makes everything a lot quicker.
It is incredibly gratifying to look at my code and say it really is getting cleaner as I work on it more :) The new constraint classes are a lot simpler, once a lot of plumbing code was obsoleted and removed.
It's still slow drawing multiple panels, though. There are a lot of equations for three panels plus nine characters, but almost all of them are trivial, like "a=b" or "a=b+2". I'm not sure, is it likely to be better to optimise it a bit in python (eg. keeping a list of which equations use a variable and only reduce those) or convert the guts to C++ (which should be possible, only the interface uses a lot of
dynamic stuff, a most of the rest ought to be a fairly direct translation)?
Image of example output:
https://github.com/CartesianDaemon/pylogram/blob/master/cartoonstrip.png
( Example image )
Source for example:
https://github.com/CartesianDaemon/pylogram/blob/master/example_cartoonstrip.py
It also involved tidying up the constrain solver so instead of solving everything at the end, it normalises the constraints as they're applied, which makes everything a lot quicker.
It is incredibly gratifying to look at my code and say it really is getting cleaner as I work on it more :) The new constraint classes are a lot simpler, once a lot of plumbing code was obsoleted and removed.
It's still slow drawing multiple panels, though. There are a lot of equations for three panels plus nine characters, but almost all of them are trivial, like "a=b" or "a=b+2". I'm not sure, is it likely to be better to optimise it a bit in python (eg. keeping a list of which equations use a variable and only reduce those) or convert the guts to C++ (which should be possible, only the interface uses a lot of
dynamic stuff, a most of the rest ought to be a fairly direct translation)?