[Edu-sig] PDF geometry animations (ReportLab?) - and turtle module
kirby.urner at gmail.com
Sun May 17 20:53:02 CEST 2009
On Sun, May 17, 2009 at 9:06 AM, Edward Cherlin <echerlin at gmail.com> wrote:
> On Sun, May 17, 2009 at 6:35 AM, Gregor Lingl <gregor.lingl at aon.at> wrote:
>> kirby urner schrieb
Brilliant work Gregor, ran yours just now (I have 2.5, 2.6 and 3.0 all
installed on Ubuntu Dell Jackalope laptop, WinXP KTU3 lagging in its
number of Pythons).
Happy birthday to me! (literally -- turning 51 today)
I think Ron will be quite pleased with such a quick turnaround, and
such a faithful reproduction, right down to the colors.
If we have a "sea turtles" model, then maybe they'll render his
"rotating egg" flipbook as well, the topic of the half-gig one I
downloaded @ Linus Pauling House yesterday, my CSO present in case
anyone thought they could steal this IP (half joking, Glenn was there
just to hang out and talk about stuff).
Having this uber-teacher in Vienna managing Python's turtle assets is
one of the best developments lately, liked your Blip .tv and sharing a
BOF etc. Glad we could finally overlap in person a little (Pycons are
great for that).
Ron is fighting for his life BTW, in medical therapy, gives himself
50-50 odds of making it to a next chapter (he's based in Brooklyn,
we've never met personally, but I have lots of street cred in the same
Bucky circles he travels, we're getting along well).
This will be better than a "get well soon" card I'm thinking. His
website is here: ronresch.com (lots of great ideas, he says only 20%
of his geometry research has been unveiled to date).
>>> For those of you looking for a way cool use of Python's ReportLab, I
>>> so far have permission to release this one example "PDF flipbook"
>>> showing how geometry concepts might be communicated using this simple
>>> animation technique:
> Yes, the Python version below works much better for me. I'm not up for
> clicking 1264 times to view the PDF.
Yes Ed, same problem over here, especially with this half gig PDF
focusing on Ron's trademark "egg" (an ellipsoidal tiling, highly
mathematically defined -- he outputs these frame directly from
hand-written PostScript that takes forever to debug, given this
language's rather primitive IDE). I was thinking ReportLab (Python's
most developed direct-to-PDF FOSS package) but Gregor has opened my
eyes (as Daniel Ajoy did, in terms of appreciating Logo's nuances --
not that this is your grandmother's Logo anymore, now that we're in
Ron's workshop features these big honkin' video cards where you just
hold down the down arrow key (page down), and watch the action unfold.
But not everyone has a video card that capable, including me since my
nVidia for KTU3 suffered a meltdown. I was too disappointed to bother
finding the receipt -- having this crap break all the time is a real
pain, partly why I'm on my Dell so much, as it suffers less problems,
plus of course Linux is more secure).
>> Very impressive and instructive! Is there a description somewhere, how
>> 'flipbooks' like these
>> can be produced?
I'm hoping Ron divulges more of his IP. He knows hand-writing
PostScript won't be everyone's chosen method, reminds people he was
inspired to these levels long before we had today's tools. He taught
himself to work with what he had.
When Bucky Fuller came to town (traveling roadshow circus), he was
still computing domes the old fashioned way, with lots of spherical
trig. Ron checked out huge piles of books on the subject and
basically self-invented a vector-based way of doing it much more
easily, which he shared with Fuller's whistle-stop train crew.
Fuller tending to accept any contribution (he'd circulate a box after
some lectures, take home a pile of student papers) and then toss the
results to the world as leaflets out the back of his choo choo, while
running for president of Design Science Incorporated. He was open
sourcing and patenting at the same time, playing FOSS boss and IP
king. Quite the Dymaxion Clown act.
He alienated some people with this style of showmanship, but Fuller
himself thought only an express train could work at this time, people
could go back later and put the pieces together, so he made a lot of
detailed notes (now warehoused in Stanford University) and we have
puzzle assemblers crawling through it, putting together (computing)
all kinds of new stories.
>> With me this way of communicating geometry concepts worked rather well, as
>> you can see in the attachment.
>>> I've been sharing this as a teaser with Software Association of Oregon
>>> as well, knowing Ron has a lot more where that came from (I'm suppose
>>> to download a half-gig PDF next time in Pauling House for a bored er
>>> board meeting).
>> # uses turtle module from Python 2.6
>> # hint from Kirby, 15. 5. 09
>> # http://www.4dsolutions.net/presentations/pdf_animation_by_ron_resch.pdf
>> from turtle import Turtle, Screen, Vec2D, mainloop
>> import math
>> A = 50. # adjust this to your needs
>> SHS = A / 20
>> SF = 1.0
>> DSF = 1.0038582416
>> e = Vec2D(3**.5/2, 0.5)
>> def dsin(angle):
>> return math.sin(angle*math.pi/180)
>> def lines(l):
>> for i in range(6):
>> class TriTurtle(Turtle):
>> def __init__(self, c, r, tritype):
>> Turtle.__init__(self, shape="triangle")
>> self.c = c
>> self.r = r
>> if tritype == 1:
>> self.basecolor = (1.0, 0.80392, 0.0)
>> self.f = -1
>> self.basecolor = (0.43137, 0.43137, 1.0)
>> self.f = 1
>> self.goto(c*A, r*A*3**.5/3)
>> self.shapesize(SHS, SHS, 1)
>> self.D = self.distance(0,0)
>> self.e = (1/self.D)*self.pos()
>> def setturn(self, phi):
>> if abs(self.c) + abs(self.r) > 2:
>> self.fillcolor([x + (1-x)*phi/360 for x in self.basecolor])
>> bc = phi/360.
>> self.pencolor(bc, bc, bc)
>> s = Screen()
>> d = Turtle(visible=False)
>> triangles = 
>> for c in range(-5,6,2):
>> triangles.append(TriTurtle(c, 1, 1))
>> triangles.append(TriTurtle(c, -1, 2))
>> for c in range(-4,5,2):
>> triangles.append(TriTurtle(c, 2, 2))
>> triangles.append(TriTurtle(c, -2, 1))
>> triangles.append(TriTurtle(c, -4, 2))
>> triangles.append(TriTurtle(c, 4, 1))
>> for c in range(-3,4,2):
>> triangles.append(TriTurtle(c, 5, 2))
>> triangles.append(TriTurtle(c, -5, 1))
>> triangles.append(TriTurtle(c, -7, 2))
>> triangles.append(TriTurtle(c, 7, 1))
>> for c in range(-2,3,2):
>> triangles.append(TriTurtle(c, 8, 2))
>> triangles.append(TriTurtle(c, -8, 1))
>> for phi in range(1,361):
>> SF = SF*DSF
>> for t in triangles:
>> Edu-sig mailing list
>> Edu-sig at python.org
> Silent Thunder (默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر ج) is my name
> And Children are my nation.
> The Cosmos is my dwelling place, The Truth my destination.
> http://earthtreasury.org/worknet (Edward Mokurai Cherlin)
> Edu-sig mailing list
> Edu-sig at python.org
More information about the Edu-sig