 (ns org.gavrog.clojure.selfdual2d
-  (:use (org.gavrog.clojure [util :only [unique]]
-                            [delaney :only [s v size dim curvature]]))
+  (:use (org.gavrog.clojure
+          [util :only [unique]]
+          [delaney :only [s v size dim curvature orbit-reps]]))
   (:import (org.gavrog.jane.fpgroups SmallActionsIterator)
            (org.gavrog.jane.numbers Whole)
            (org.gavrog.joss.dsyms.basic DSymbol)

           (org.gavrog.joss.dsyms.generators DefineBranching2d))
  (:gen-class))

(defn self-dual? [ds] (= ds (.dual ds)))

(defn proto-euclidean? [ds] (>= (curvature ds 1) 0))

(defn andp [& preds]
  (fn [& args]

    (filter (andp self-dual? proto-euclidean?)
            (map #(.flat (DSCover. G %))
                 (SmallActionsIterator. (.getPresentation G) max-size false)))))

;; All self-dual, 2d euclidean tilings with only two face sizes and at least
;; one triangle.
(defn d-syms [max-size]
  (for [dset (d-sets max-size)
        dsym (lazy-seq (DefineBranching2d. dset 3 3 Whole/ZERO))
        :when ((andp self-dual? minimal? euclidean? good-face-sizes?) dsym)]
    dsym))
