 ;; Gravitative Energy and Force
 
 (defn- phi
-  "Returns the angle between a inf-irreducible node [x_1,y_1]
+  "Returns the angle between an inf-irreducible node [x_1,y_1]
   and its upper neighbor [x_2, y_2]."
   [[x_1,y_1] [x_2,y_2]]
   (with-doubles [x_1, y_1, x_2, y_2]

		    node-connections)]
     (sum [[v pos-v] node-positions,
	   [x y pos-x pos-y] edges
	   :when (not (#{x, y} v))]
	 (/ 1.0
	    (double (node-line-distance pos-v [pos-x, pos-y])))))
   (catch Exception e
     Double/POSITIVE_INFINITY)))

(defn- repulsive-force
  ""
  [layout n_i part information]
  (throw (UnsupportedOperationException. "Not yet implemented.")))

;; Attractive Energy and Force


	E_1   (double (+ E_0 Math/PI))]
    (try
     (sum [n inf-irrs]
       (let [phi_n (double (phi (node-positions n)
				(node-positions (upper-neighbours n))))]
	 (cond
	  (<= 0 phi_n phi_0)
	  (+ phi_n
	     (/ (square (Math/sin phi_0))
		(Math/tan phi_n))
	     E_0),

	  (<= (- Math/PI phi_0) phi_n Math/PI)
	  (+ (- phi_n)
	     (/ (- (square (Math/sin phi_0)))
		(Math/tan phi_n))
	     E_1),

	  :else 0)))
     (catch Exception e
       Double/POSITIVE_INFINITY))))

