The piccy-graph library
The first thing you need to know is...
How to install this library, or any teachpack
How this library works:
The piccy graph library uses "screen coordinates". On your graphing calculator, you may be used to setting your own window limits. Some graphics systems provide real-numbered "eye-coordinates" that are more like you are used to from math. This one doesn't.
This means the coordinates of points in the canvas have the origin in the upper right hand corner, and we only use integers. In math the coordinate pairs are read as "over and up", and in screen coordinates, they are read "over and down". So a pixel at (40, 100) is 40 pixels over and 100 pixels down.
Jot this sketch down and
keep it where you can see it while you are making up screen coordinates.
| draw-pic | col | pt | dot |
| empty-pic-w-title | line | hash | rect |
| circle | tri | clrscr | wait |
| ROY G BIV B W(color constants) |
Drawing: draw-pic: pic -> void (define (draw-pic a-pic) ...)
purpose: draw-pic's purpose is to draw the picture corresponding to a pic. Note that it produces "void", which means "no value", so don't use in any way other than as the outermost application in an expression.
Starting A Pic:
empty-pic-w-title : num num string -> pic (define (empty-pic-w-title w h title) ...)
This is one way to start a pic. The other is to use empty-pic, which is a constant and not a function.
Graphics Primitives:
col: col pic-> pic (define (col color pic) ...)
col sets the drawing color for the graphics calls that come later, that is, outside of it. Legal values for color are BLACK, WHITE, RED, ORANGE, YELLOW, GREEN, BLUE, INDIGO and VIOLET.
pt : num num pic -> pic (define (pt x y a-pic) ...)
pt draws a single pixel at x y.
dot : num num pic -> pic (define (dot x y a-pic) ...)
dot is like pt, but bigger.
hash : num num num pic -> pic (define (hash x y angle a-pic) ...)
A hash mark is a little short line segment. It can be turned at an angle. The angles are in radians. They're good for marking number lines, and some other purposes.
line : num num num num pic -> pic (define (line x1 y1 x2 y2 a-pic) ...)
line draws a line, given the coordinate pairs of the end points.
rect : num num num num pic -> pic (define (rect x1 y1 x2 y2 a-pic)...)
rect draws a rectangle given 2 opposite corners
circle : num num num pic-> pic (define (circle x y r a-pic)...)
circle draws a circle given a location (x y) and a radius r.
tri : num num num num num num pic -> pic (define (tri x1 y1 x2 y2 x3 y3 a-pic)...)
tri draws a solid triangle, given 6 numbers, which are the coordinates of 3 points.
clrscr : pic -> pic (define (clrscr a-pic)...)
This clears everthing that has been drawn so far. clrscr + wait allow you to do simple animation.
wait : number pic -> pic (define (wait sec a-pic)...)
Makes a delay. It is in real-number seconds. So if you want a 0.25
second delay, (or a 1/3 sec delay) then you use that number.
And the color constants are black white and "Roy G. Biv".
You might find it fun to look at their values. They are objects that MrEd recognizes.
RED ORANGE YELLOW GREEN BLUE INDIGO VIOLET BLACK WHITE
The most convenient thing to do is to use explorer and put piccy-graph.ss into the directory:
C:\Program Files\PLT\teachpack
Then when you want to use it go to the LANGUAGE menu, and select ADD TEACHPACK, and select it in the open dialog that comes up.
Then, press execute to load the teachpack.