Cartesian grids fill a coordinate rectangle, and have a specified number of lines in each direction. A polar grid has specified radius, rings, and sectors.
grid(n1, n2); // fills the bounding box grid(p1, p2, n1, n2); // fills the box with corners p1, p2 grid(p1, p2, mesh(n1, n2), mesh(m1,m2)); polar_grid(r, n1, n2);Each command draws an n1 by n2 grid. The third uses an mesh, which is useful only if the camera lens does not map lines in object space to lines on the screen.
Graph paper may be created by superimposing grids:
pen(0.25); grid(10*x_size, 10*y_size); pen(0.5); grid(2*x_size, 2*y_size); pen(1); grid(x_size, y_size); |
S. D. Pedersen's contrib/ package provides enhanced Cartesian graphs. See contrib/doc in the source for documentation.