Discussion:
Elipse "cannot invert matrix" possible fix
Stuart Axon
2010-09-23 03:12:07 UTC
Permalink
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))
Stuart Axon
2010-09-23 20:56:41 UTC
Permalink
Thought about this during the day and of course it makes sense, so will push to
repository :)

S++



----- Original Message ----
Sent: Thu, September 23, 2010 3:12:07 AM
Subject: [shoebot-devel] Elipse "cannot invert matrix" possible fix
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()
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()
+ 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()
raise ShoebotError(_("PathElement(): error parsing path
element
command (got '%s')") % (cmd))
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
ricardo lafuente
2010-09-23 22:12:36 UTC
Permalink
yay!
yeah, cairo's scale errors out on zero values (and not only that, but i
forgot now... i think the scale() function has safeguards against this).
Probably this is due to rounding? But anyway, if it's fixed, it's gone
:) thanks Stuart!
Post by Stuart Axon
Thought about this during the day and of course it makes sense, so will push to
repository :)
S++
----- Original Message ----
Sent: Thu, September 23, 2010 3:12:07 AM
Subject: [shoebot-devel] Elipse "cannot invert matrix" possible fix
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()
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()
+ 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()
raise ShoebotError(_("PathElement(): error parsing path
element
command (got '%s')") % (cmd))
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Stuart Axon
2010-09-24 12:59:52 UTC
Permalink
Cool, will commit this later - that's one annoying bug down at least !

----- Original Message ----
Sent: Thu, September 23, 2010 10:12:36 PM
Subject: Re: [shoebot-devel] Elipse "cannot invert matrix" possible fix
yay!
yeah, cairo's scale errors out on zero values (and not only that, but i
forgot now... i think the scale() function has safeguards against this).
Probably this is due to rounding? But anyway, if it's fixed, it's gone
:) thanks Stuart!
Post by Stuart Axon
Thought about this during the day and of course it makes sense, so will push
to
Post by Stuart Axon
repository :)
S++
----- Original Message ----
Sent: Thu, September 23, 2010 3:12:07 AM
Subject: [shoebot-devel] Elipse "cannot invert matrix" possible fix
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
Post by Stuart Axon
to
apply it though as my maths isn't strong enough to tell if this is
breaking a
Post by Stuart Axon
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()
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()
+ 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()
raise ShoebotError(_("PathElement(): error parsing
path
Post by Stuart Axon
element
command (got '%s')") % (cmd))
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
; _______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
_______________________________________________
Shoebot-devel mailing list
http://lists.tinkerhouse.net/listinfo.cgi/shoebot-devel-tinkerhouse.net
Loading...