Positions


Building Positions

(position-new col row)
MediaScheme Position Procedure. Build a new position that represents the point at (col,row).

Accessing Components

(position-col pos)
MediaScheme Position Procedure. Extract the column from position pos.
(position-row pos)
MediaScheme Position Procedure. Extract the row from position pos.

Miscellaneous

(position? value)
MediaScheme Position Procedure. Determine if value is a position (or can be interpreted as such).
(position-offset position hoff voff)
MediaScheme Position Procedure. Create a new position, offset from position horizontally by hoff and vertically by voff.
(position-distance pos1 pos2)
MediaScheme Position Procedure. Compute the distance between pos1 and pos2.
(position-interpolate pos1 pos2 percent)
MediaScheme Position Procedure. Create a new position which is percent (expressed as a real number between 0 and 1) of the way from pos1 to pos2
(random-positions n cols rows)
MediaScheme Position Procedure. Create n positions, each of which is difficult to predict and each with a non-negative column less than cols and a non-negative row less than rows.

Jerod Weinman

Copyright 2007-2012 Janet Davis, Matthew Kluber, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials copyright by John David Stone and Henry Walker and used by permission.)

This material is based upon work partially supported by the National Science Foundation under Grant No. CCLI-0633090. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.

Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License .