These are the user-level functions defined in FPIC. The most important type is Picture. Users will also use operations on real numbers and on Points.
Lengths are given in centimeters.
In addition to drawing the pictures, these operations also create environments naming the points of that picture corresponding to compass directions. These points are called n, s, e, w, ne, se, nw, and sw, as well as center. Where indicated, some additional points may be automatically named. Users can add additional named points as well as named subpictures using the operations in the environments section.
empty
: Picture.
box
: Real * Real -> Picture. Arguments are width and height.
oval
: Real * Real -> Picture. Same as box arguments.
polygon
: Point list -> Picture. Draws a closed polygon.
openCurve
: Point list -> Picture. Interpolates an open curve.
closedCurve
: Point list -> Picture. Interpolates a closed curve.
wedge
: real * real * real -> Picture.
wedge rad theta1 theta2 draws a wedge of a circle of radius rad
from angle theta1 to theta2.
Angles are given in degrees.
The wedge is drawn counterclockwise, so that wedge 1.0 10.0 -10.0
will draw almost an entire circle.
arc
: real * real * real -> Picture. Same arguments as wedge.
arccw
: real * real * real -> Picture. Same arguments as arc, but
with the arc drawn clockwise from the first angle to the second.
square
: real -> Picture.
triangle
: Point -> Point -> Point -> Point.
circle
: real -> Picture.
point
: Point -> Picture. Draws a small filled circle.
tript
: real * real -> Picture. Draws small triangle.
sqpt
: real * real -> Picture. Draws small square.
crpt
: real * real -> Picture. Draws small cross.
bezier
: Point * Point * Point * Point -> Picture.
label
: string -> Picture -> Picture.
label s p draws p with string s in the middle.
clearbox
: Real * Real -> Picture. Same arguments as box, but
does not draw anything. Used for spacing.
hspace
: Real -> Picture. Zero-height horizontal space.
vspace
: Real -> Picture. Zero-width vertical space.
dbox, doval, dcircle, dtriangle
: Picture.
These are "default" shapes, useful when the exact shape doesn't
really matter.
For boxes and ovals, uses the golden ratio.
The triangle is an equilateral triangle with base 1.
These are mainly functions from pairs of points to pictures. In addition to the compass points (which don't really make that much sense for lines), the have named points start, end, and midpoint.
line
: Point * Point -> Picture. Draws a line between the
two points.
arrow
: Point -> Point -> Picture.
doublearrow
: Point -> Point -> Picture.
harrow
: real -> real -> Picture. harrow ht leng draws an
arrow at height ht and length leng from left to right.
curvedhline, curvedvline
: Point -> Point -> Picture.
Draw a curved line, with the first leg of the curve either
horizontal or vertical.
Transformations are translation, rotation, scaling, changes of color, and other stuff. Many of these transformations come directly from pstricks.
There is a fine line between translation operations, in which a picture is moved, and sequencing operations, in which two pictures are drawn together, with one of them usually being moved. We have placed operations that move a single picture here, and operations that combine two pictures, even when they involve a translation of one of the pictures, in the section on sequencing operations.
offsetBy
: Picture * (real * real) -> Picture (infix).
at
: Picture * Point -> Picture (infix). pic at pt is pic
drawn with its southwest corner at pt.
centeredAt
: Picture * Point -> Picture (infix). pic centeredAt pt
is pic drawn with its center at pt.
place
: Picture -> (Picture -> Point) -> Point -> Picture.
place p ptfun pnt draws p in a location such that (ptfun p) = pnt.
placePt
: Picture -> string -> Point -> Picture.
placePt p name pt places p at a location such that the point
named name is at point pt.
up, down, left, right
: Picture * real -> Picture (infix).
Move the picture by the indicated amount.
scale
: Picture * real -> Picture (infix). pic scale s is pic
drawn with its dimensions multiplied by s.
scaleX, scaleY
: Picture * real -> Picture (infix). Picture is
scaled only in one dimension.
scaleXY
: Picture * (real*real) -> Picture (infix). Picture
scaled in both dimensions.
scaleWithPoint
: Picture * ((real*real)*Point) -> Picture.
Scale picture in both dimensions, leaving a given point fixed.
Normally, scaling leaves the anchor point (southwest) fixed.
scaleTo
: Picture * (real*real) -> Picture (infix).
scaleTo p (w,h) scales p so that it fits within a box of size
w-by-h, but without changing p's aspect ratio.
resize
: Picture * (real*real) -> Picture (infix).
resize p (w,h) scales p so that its width is w and its height is h.
rotate
: Picture * real -> Picture (infix). pic rotate r is pic
rotated by r (an angle in degrees) around its center.
rotateWithPoint
: Picture * (real*Point) -> Picture (infix).
Picture rotated around a given point.
withBoundingBox
:
withLineColor
: Picture * (real*real*real) -> Picture (infix).
withFillColor
: Picture * (real*real*real) -> Picture (infix).
withFillStyle
: Picture * string -> Picture (infix).
Fill styles are defined by pstricks.
withArrowStyle
: Picture * string -> Picture (infix).
Arrow styles are defined by pstricks.
withLineStyle
: Picture * string -> Picture (infix).
Line styles are defined by pstricks.
withLineWidth
: Picture * real -> Picture (infix).
withCurvature
: Picture * (real*real*real) -> Picture (infix).
This comes from pstricks; I'm not sure what it does.
withAttribute
: Picture * (string*string) -> Picture (infix).
Add an arbitrary attribute (to be interpreted by pstricks) to
a picture.
transformedWith
: Picture * Matrix -> Picture (infix).
A Matrix is a transformation matrix of type (real*real*real)*
(real*real*real). (It might take some experimentation to get
the values in the right order, as determined by Postscript.)
These operations create compound pictures. (We call these sequencing operations.)
seq
: Picture * Picture -> Picture (infix). Draw both pictures.
hseq
: Picture * Picture -> Picture (infix). Draw the two
pictures right next to one another.
vseq
: Picture * Picture -> Picture (infix). Draw the first
picture on top of the second.
cseq
: Picture * Picture -> Picture (infix). Draw both pictures,
with their centers aligned.
hseqsp, vseqsp
: Picture * real -> Picture -> Picture (infix).
Like hseq and vseq, but with a gap added.
align
: (Picture * Point) * (Picture * Point) -> Picture (infix).
Draw the two pictures such that the two points coincide.
tile
: (Picture * Picture -> Picture) -> int -> Picture ->
Picture.
tile f n pic draws n copies of pic, connected by f.
stick
: int -> Picture -> Picture. stick n pic draws n
copies of pic right next to one another.
stack
: int -> Picture -> Picture. stick n pic draws n
copies of pic on top of one another.
connect
: Picture -> Picture -> (Point * Point -> Picture)
-> Picture. connect p q f draws p, q, and f(p,q). The intention
is that f is a "line function."
mkseqfun
: (Picture -> Point) -> (Picture -> Point) ->
Picture * Picture -> Picture.
mkseqfun f g returns a function that draws pictures p and q
so that (f p) and (g q) coincide.
mkseqlist
: SequenceOp -> Picture list -> Picture.
A SequenceOp is a function in Picter * Picture -> Picture.
mkseqlist op pics draws all the pics using op to combine them.
It is basically fold.
seqlist, hseqlist, vseqlist, cseqlist
: Picture list -> Picture.
Combine a list of pictures using the indicated sequencing operator.
lineseq
: Picture * Picture -> Picture (infix).
Sequences two lines, drawing the second line so that its start point
coincides with the end point of the first line.
lineseqlist
: Picture list -> Picture.
These operations relate to naming and numbering of pictures. All pictures come with some of their points named, as described above. Users may add additional named points using the operations listed here. Note that named points are transformed long with the picture itself, so that point "s" may not be south at all, if the picture has been rotated. To get "true" south, or any other point, use operations boundingBox and related operations like north and center, which are also included in this section.
An irritating subtlety here has to do with numbering of subpictures.
Since all operations are binary, it would seem that every compound
picture would have only two subpictures, which is counterintuitive,
so the combining operations listed above will generally "flatten"
the environment structure.
On the other hand, some structure is desirable.
So, the group operation prevents the flattening of that
picture within a larger picture.
For example, p1 seq p2 seq p3
has three subpictures
(numbered 1, 2, and 3), while
p1 seq (group (p2 seq p3))
has two subpictures,
the second of which has two subpictures.
When named pictures are added using addNamedPic or addNamedPics,
they are automatically grouped.
group
: Picture -> Picture. Groups all the subpictures in
a compound picture into a single picture.
This affects the numbering of pictures in the nthPic function.
pt
: Picture * string -> Point (infix). pt p s is the point
named s in picture p.
pic
: Picture * string -> Picture (infix). pic p s is the picture
named s in picture p.
nthpic
: Picture * int -> Picture (infix). pic p n is the nth
picture in p.
namePt
: Picture -> string -> Point -> Picture. pic p s pt is
the picture p with the point pt having name s.
namePts
: Picture -> (string * Point) list -> Picture.
namePic
: Picture -> string -> Picture.
Name a picture, so that it will have this name when placed inside
a compound picture.
This will also have the effect of grouping this picture (the grouping
will be done at the time the picture is added to the larger picture).
addNamedPic
: Picture -> string -> Picture -> Picture.
addNamedPic p1 str p2 is the picture p1 with picture p2 named str.
addNamedPics
: Picture -> (string * Picture) list -> Picture.
pics
: Picture -> (string * Picture) list.
All of the subpictures that have names.
pts
: Picture -> (string * Point) list.
All of the points in the picture that have names, along with those names.
boundingBox
: Picture -> Point * Point * Point * Point.
The points in a bounding box are given in order northwest, northeast,
southwest, and southeast.
width
: Picture -> real.
height
: Picture -> real.
center, north, south, east, west, northeast, northwest, southeast,
southwest
: Picture -> Point.
trueOrigin
: Picture -> Point.
Colors are just triples of real numbers (RGB values) between 0 and 1. The predefined colors are:
red = (1.0,0.0,0.0)
-
green = (0.0,1.0,0.0)
-
blue = (0.0,0.0,1.0)
-
white = (1.0,1.0,1.0)
-
black = (0.0,0.0,0.0)
-
magenta = (1.0,0.0,1.0)
-
cyan = (0.0,1.0,1.0)
-
lightGray = (0.7,0.7,0.7)
-
darkGray = (0.4,0.4,0.4)
-
yellow = (1.0,1.0,0.0)
These operations create points, which are pairs of real's, or otherwise manipulate them.
++
: Point * Point -> Point (infix).
--
: Point * Point -> Point (infix).
**
: Point * Point -> Point (infix).
//
: Point * Point -> Point (infix).
distance
: Point -> Point -> real.
midpoint
: Point -> Point -> Point.