PyGeom at FreeGeek:
Rita's Notes

Hello All,
 
This week Kirby talked about another piece of software we will be using soon to draw with!!!
 
You will need to go to www.povray.org  and download povray version 3.5.  But while you are
there, look at those amazing pictures that were made with this software!  POVray will allow 
us to draw just about anything it seems, undoubtedly with a bit (some...a lot) of practice. 
POVray will let us define where an eye (or camera) is and where light sources are, and then 
bounce light off of whatever object we've given it , such as a triangle, cube, etc.  POVray will 
create the image that the eye would see, based on the info we supplied about the object's 
shape, texture, color, etc.
 
Don't let this overwhelm you, we will start slow.  Basically we are going to use Python to put 
together lists of points, and then connect them.  We will send this info from Python to POVray 
and let it draw what we created.
 
 
Instructions for downloading POVray:
 
Go to www.povray.org.  In the yellow bar at the top click "download".  On the next page,
 scroll down to the "Windows" heading and click 'Download (8 MB) via the web'.  Then it 
will step you through.  (You'll want to save it to disk...)
 
 
This week we talked about Python's data structures.  These structures in some form or 
another show up in just about all programming languages.  They are:
 
Lists:  Lists in Python can be recognized by the square brackets with elements inside, 
separated by comas.  We can retrieve things from a list using an index #.
    Ex:  [ 'a', 1, 5]
 
Dictionary;  Dictionaries can be recognized by their 'curly' brackets.  We can retrieve 
things from a dictionary using names.
    Ex: {    }
 
Tuples:  A tuple is like a list but uses parenthesis, with elements inside.  A tuple cannot
 be changed once it's defined.  For example you could not change the order of the 
elements in a tuple.
    Ex: (   )
 
String:  A sequence of characters.
    Ex: 'kirby'
 
 
We learned that objects, such as those in a list have attributes  and methods.  Attributes 
are characteristics and methods are actions. For example, a dog might have the attributes
of being hairy or angry.  A dog's methods might be barking or eating.
 
Kirby went on to expose us to the syntax using an object with it's attributes or methods.
 
Ex;  object. attribute    could be stated   mydog.texture =  'brown, furry'
Ex.  object.method      could be stated   mydog.bark(3), where 3 refers to the loudness of the bark
 
Here's a few other examples we played with,
 
>>>a = 'kirby'
>>>a.upper ( ), will return KIRBY
 
>>>a = 'the great escape'
>>>a.title( ), will return The Great Escape
 
We can ask for a directory of all the 'methods' (that is, things) Python can do with a string (or 
list, dictionary or tuple), by doing the following:
 
>>>dir(a) 
    where a is the name of a string
 
 
See ya Friday!
 
Rita Petherbridge
rbridge@ix.netcom.com
 
Kirby can be reached at:  kirby@4dsolutions.net.  

oregon.gif - 8.3 K
Oregon Curriculum Network