              (float x3) (float y3) (float z3)
              (float x4) (float y4) (float z4))))
 
-(defn curve-detail [detail] (.curveDetail *applet* (int detail)))
+(defn curve-detail
+  "Sets the resolution at which curves display. The default value is
+  20. This function is only useful when using the P3D or OPENGL
+  renderer as the default (JAVA2D) renderer does not use this
+  information."
+  [detail]
+  (.curveDetail *applet* (int detail)))
 
 (defn curve-point
+  "Evalutes the curve at point t for points a, b, c, d. The parameter
+  t varies between 0 and 1, a and d are points on the curve, and b and
+  c are the control points. This can be done once with the x
+  coordinates and a second time with the y coordinates to get the
+  location of a curve at t."
   [a b c d t]
   (.bezierPoint *applet* (float a) (float b) (float c) (float d) (float t)))
 
 (defn curve-tangent
+  "Calculates the tangent of a point on a curve.
+  See: http://en.wikipedia.org/wiki/Tangent"
   [a b c d t]
   (.curveTangent *applet* (float a) (float b) (float c) (float d) (float t)))
 
-(defn curve-tightness [ti]
+(defn curve-tightness
+  "Modifies the quality of forms created with curve and
+  curve-vertex. The parameter squishy determines how the curve fits
+  to the vertex points. The value 0.0 is the default value for
+  squishy (this value defines the curves to be Catmull-Rom splines)
+  and the value 1.0 connects all the points with straight
+  lines. Values within the range -5.0 and 5.0 will deform the curves
+  but will leave them recognizable and as values increase in
+  magnitude, they will continue to deform."
+  [ti]
   (.curveTightness *applet* (float ti)))
 
 (defn curve-vertex

  [num exponent]
  (PApplet/pow (float num) (float exponent)))

;; $$print

(defn print-camera [] (.printCamera *applet*))

;; $$println

(defn print-matrix [] (.printMatrix *applet*))

(defn print-projection [] (.printProjection *applet*))

(defn push-matrix
  "Pushes the current transformation matrix onto the 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 ^{:arglists (:arglists (meta #'abs-float))
       :doc (:doc (meta #'abs-float))}
  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))

(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))))

(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)))
