Fractagons - an IFS fractal image generator

24 views
Skip to first unread message

John Lynch

unread,
Oct 12, 2017, 5:46:42 PM10/12/17
to clj-processing
Hi.

I have been learning Clojure by using Quil to develop an iterated function system (IFS) fractal image generating sketch.

I've just written a rake of documentation for it (see the README.md) and got it into a state ready (sort of) for public consumption.

I haven't yet tested it against the Clojurescript compiler, which is why it's on Github and not yet on quil.info.

So if anyone wants to play with it, tweak it, comment on it, optimise it, add a UI or whatever, please feel free!

To get Fractagons, clone my repo at


John  :)





Nikita Beloglazov

unread,
Oct 14, 2017, 1:12:55 AM10/14/17
to clj-processing
Nice! Do you have any screenshots maybe? I haven't had a chance to run it locally yet. 

--
You received this message because you are subscribed to the Google Groups "clj-processing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clj-processin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nikita Beloglazov

unread,
Oct 14, 2017, 6:19:37 PM10/14/17
to clj-processing
Tried it locally. Looks cool! Watching how fractals sloooowly grow. Is it possible increase speed somehow? Like from 1 pixel per frame to 5-10 and see what we get. Personally I just want to press "g" to generate random state and see what I get :) 

As you mentioned, I'd love to have it on quil.info. Though maybe simpler version? With fewer possible controls. We can always add link to the full version. Also for quil.info all skecthes should be implemented in single file. So that users an open them in quil.info playground and run/modify them. Though looking at your code you already have everything mostly in a single file. Please let me know if you need any help! 

Good job! 

Nikita

John Lynch

unread,
Oct 15, 2017, 3:04:23 PM10/15/17
to clj-processing

Great, thanks Nikita. 

I have combined the code into one core.clj file, and, I think added the appropriate directives.   The sketch now runs frrom terminal with `lein run`.   I made an uberjar

Howerver, when I run the uberjar with
`java -jar target/fractagons-1.0.0-SNAPSHOT.jar`
I get
`Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Var
at fractagons.core.<clinit>(Unknown Source)
Caused by: java.lang.ClassNotFoundException: clojure.lang.Var
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
`

I wonder what I'm missing.   

My core.clj is like
`(ns fractagons.core
  (:require [quil.middleware :as m]
            [quil.core :as q]
            [clojure.string :as str])
  (:gen-class))
(import javax.swing.JFileChooser)

;;;;    setup, draw and other functions

(defn -main [& args]
  (q/sketch
    :title "Fractagons"               
    :setup setup
    :update update-state           
    :draw draw
    :mouse-clicked mouse-clicked             
    :key-typed key-typed             
    :size [768 768]
    :features [:exit-on-close]
    :middleware [m/fun-mode]))`

and my project.clj is

`(defproject fractagons "1.0.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [quil "2.6.0"]]
  :aot          [fractagons.core]
  :main         fractagons.core
  :repl-options {
             ;; If nREPL takes too long to load it may timeout,
             ;; increase this to wait longer before timing out.
             ;; Defaults to 30000 (30 seconds)
             :timeout 120000
             }
)`


Nikita Beloglazov

unread,
Oct 15, 2017, 4:18:11 PM10/15/17
to clj-pro...@googlegroups.com

No idea. Can you try creating empty sketch and run it as uberjar? I'm wondering whether it's something in your code or in quil itself causing the problem.


John Lynch

unread,
Oct 15, 2017, 8:08:48 PM10/15/17
to clj-processing
Oops.   My error.   The lein uberjar command seems to create two jarfiles.   The one with "standalone" is the one which works.   (I wonder what the other one's for?!)
Reply all
Reply to author
Forward
0 new messages