Wednesday, 18 July 2007

Steady on

A friend pointed out to me that actually I have reinvented the "three point steady". Here are some examples I found on the web :-







Incidentally the only reason mine has flat sides is because the width was limited by the size of the raw material .

I have not had a chance to try it out yet, but it looks like I am on a well trodden track.

I have had a request to show the ten lines of Python which draw the simulation window. These are :-

In the constructor:

self.root = Tk()
self.root.title("HydraRaptor")
frame = Frame(self.root)
frame.pack()
self.canvas = Canvas(frame, width = 710, height = 765)
self.canvas.create_rectangle(-70*5, -76*5, 70*5, 76*5)
self.canvas.pack()

In the destructor:
self.canvas.config(scrollregion=self.canvas.bbox(ALL))
self.root.mainloop()

In the feed_xy function:
self.canvas.create_line(self.xy[0]*5, -self.xy[1]*5, pos[0]*5, -pos[1]*5)

I am sure there is a better way to do the scaling, replacing the magic numbers with constants would be a start!

No comments:

Post a Comment