Presenting Mathematical Concepts on the World Wide Web
Forms & Scripts

Using Scripts: Handling Coordinate Systems

The Geometry Center has developed a Perl module containing a number of subroutines for handling coordinate systems, axes, etc. To use this library in your own Perl scripts, you must include the library in your script as shown:
#!/usr/local/bin/perl

require "axes.pl";
.
.
.

Subroutines in axes.pl


gifsize

Calling Syntax: &gifsize(xmin, xmax, ymin, ymax, xmid, ymid)

You must call gifsize before any other axes.pl routines, except pssize.

You can determine the gif coordinates of a region in a gif by using the middle mouse button in xv.


pssize

Calling Syntax: &pssize(xmin, xmax, ymin, ymax)

You must call pssize before any other axes.pl routines, except gifsize.


sizetofit

Calling Syntax: &sizetofit(xmax, ymax)

This routine chooses the user coordinate system so that the input point lies in the first quardrant region determined by the axes, which are in turn implicitly determined by the gif coordinates of the origin and the bounding box specified in gifsize>. The routine may srhink the user region more than is necessary to accomodate the input point to achieve better tick marks.

This routine requires that gifsize be called first. pssize can be called after, but none of the coordinate conversion routines involving PostScript coordinate will function until pssize called.


u2p

Calling Syntax: (px, py) = &u2p(ux, uy)


p2u

Calling Syntax: (ux, uy) = &p2u(px, py)


u2g

Calling Syntax: (gx, gy) = &u2g(ux, uy)


g2u

Calling Syntax: (ux, uy) = &g2u(gx, gy)


p2g

Calling Syntax: (gx, gy) = &p2g(px, py)


g2p

Calling Syntax: (px, py) = &g2p(gx, gy)


xticks

Calling Syntax: &xticks()

This routine attempts to intelligently draw and label tick marks on the x-axis. You will probably end up editing this routine to meet your own specifications.


yticks

Calling Syntax: &yticks()

This routine attempts to intelligently draw and label tick marks on the y-axis. You will probably end up editing this routine to meet your own specifications.


Back: Strategies for Using Scripts
Up: Forms & Scripts


Presenting Mathematical Concepts on the World Wide Web. Copyright © 1997 by Carol Scheftic. All rights reserved. (This section was originally copyrighted in 1996 by The Geometry Center and is re-used here with permission.) Please send comments on this page, or requests for permission to re-use material from this page, to: scheftic@geom.umn.edu
Page established 1-Jun-97; last updated Thursday, 24-Jul-1997 02:02:57 CDT.