   (.getWidth *applet*))
 
 (defmacro with-translation
-  "Berforms body with translation, restores current transformation on exit."
+  "Berforms body with translation, restores current transformation on
+  exit."
   [translation-vector & body]
   `(let [tr# ~translation-vector]
      (push-matrix)

      (reset! *state* state-map))))

(defn abs-int
  "Calculates the absolute value (magnitude) of a number. The absolute value of
  a number is always positive. Takes and returns an int."
  [n]
  (PApplet/abs (int n)))

(defn abs-float
  "Calculates the absolute value (magnitude) of a number. The absolute value of
  a number is always positive. Takes and returns a float."
  [n]
  (PApplet/abs (float n)))

(def abs abs-float)

(defn acos
  "The inverse of cos, returns the arc cosine of a value. This function expects
  the values in the range of -1 to 1 and values are returned in the range 0 to
  Math/PI (3.1415927)."
  [n]
  (PApplet/acos n))

;; $$addListeners

(defn alpha
  "Extracts the alpha value from a color."
  [color] (.alpha *applet* (int color)))

(defn ambient
  "Sets the ambient reflectance for shapes drawn to the screen. This is combined
  with the ambient light component of environment. The color components set
  through the parameters define the reflectance. For example in the default
  color mode, setting x=255, y=126, z=0, would cause all the red light to
  reflect and half of the green light to reflect. Used in combination with
  emissive, specular, and shininess in setting the material properties of
  shapes."
  ([gray] (.ambient *applet* (float gray)))
  ([x y z] (.ambient *applet* (float x) (float y) (float z))))

(defn ambient-int
  "Sets the ambient reflectance for shapes drawn to the screen. This is combined
  with the ambient light component of environment. The rgb color components set
  define the reflectance. Used in combination with emissive, specular, and
  shininess in setting the material properties of shapes."
  [rgb]
  (.ambient
   *applet* (int rgb)))

(defn ambient-light
  "Adds an ambient light. Ambient light doesn't come from a specific direction,
   the rays have light have bounced around so much that objects are evenly lit
   from all sides. Ambient lights are almost always used in combination with
   other types of lights. Lights need to be included in the draw to remain
   persistent in a looping program. Placing them in the setup of a looping
   program will cause them to only have an effect the first time through the
   loop. The effect of the parameters is determined by the current color mode."
  ([red green blue]
     (.ambientLight *applet* (float red) (float green) (float blue)))
  ([red green blue x y z]
     (.ambientLight *applet* (float red) (float green) (float blue)
                    (float x) (float y) (float z))))

;; $$append

(defn apply-matrix
  "Multiplies the current matrix by the one specified through the
  parameters. This is very slow because it will try to calculate the inverse of
  the transform, so avoid it whenever possible. The equivalent function in
  OpenGL is glMultMatrix()."
  ([n00 n01 n02 n10 n11 n12]
     (.applyMatrix *applet* (float n00) (float n01) (float n02)
                   (float n10) (float n11) (float n12)))

(defn rotate-x
  "Rotates a shape around the x-axis the amount specified by the angle
  parameter. Angles should be specified in radians (values from 0 to
  (* PI 2)) or converted to radians with the radians function. Objects
  are always rotated around their relative position to the origin and
  positive numbers rotate objects in a counterclockwise
  direction. Transformations apply to everything that happens after
  and subsequent calls to the function accumulates the effect. For
