Stuart Axon
2010-09-23 03:12:07 UTC
I've been trying to get lsystem1.py to work; and noticed that the problem seems
to occur in very small ellipses.
One solution seems to be a check for zero size ellipses; I don't know whether to
apply it though as my maths isn't strong enough to tell if this is breaking a
legitimate fix.
Any idea if this makes sense ?
(If anybody could test lsystem1.py on nodebox vs shoebot with this fix it might
be a start).
[+ Any other scripts that have the same "Cannot Invert Matrix error]
--- a/shoebot/core/cairo_canvas.py Thu Sep 16 09:09:31 2010 +0200
+++ b/shoebot/core/cairo_canvas.py Thu Sep 23 04:08:56 2010 +0100
@@ -207,11 +207,12 @@
self.context.close_path()
elif cmd == ELLIPSE:
x, y, w, h = values
- self.context.save()
- self.context.translate (x + w / 2., y + h / 2.)
- self.context.scale (w / 2., h / 2.)
- self.context.arc (0., 0., 1., 0., 2 * pi)
- self.context.restore()
+ if w != 0.0 and h != 0.0:
+ self.context.save()
+ self.context.translate (x + w / 2., y + h / 2.)
+ self.context.scale (w / 2., h / 2.)
+ self.context.arc (0., 0., 1., 0., 2 * pi)
+ self.context.restore()
else:
raise ShoebotError(_("PathElement(): error parsing path element
command (got '%s')") % (cmd))
to occur in very small ellipses.
One solution seems to be a check for zero size ellipses; I don't know whether to
apply it though as my maths isn't strong enough to tell if this is breaking a
legitimate fix.
Any idea if this makes sense ?
(If anybody could test lsystem1.py on nodebox vs shoebot with this fix it might
be a start).
[+ Any other scripts that have the same "Cannot Invert Matrix error]
--- a/shoebot/core/cairo_canvas.py Thu Sep 16 09:09:31 2010 +0200
+++ b/shoebot/core/cairo_canvas.py Thu Sep 23 04:08:56 2010 +0100
@@ -207,11 +207,12 @@
self.context.close_path()
elif cmd == ELLIPSE:
x, y, w, h = values
- self.context.save()
- self.context.translate (x + w / 2., y + h / 2.)
- self.context.scale (w / 2., h / 2.)
- self.context.arc (0., 0., 1., 0., 2 * pi)
- self.context.restore()
+ if w != 0.0 and h != 0.0:
+ self.context.save()
+ self.context.translate (x + w / 2., y + h / 2.)
+ self.context.scale (w / 2., h / 2.)
+ self.context.arc (0., 0., 1., 0., 2 * pi)
+ self.context.restore()
else:
raise ShoebotError(_("PathElement(): error parsing path element
command (got '%s')") % (cmd))