Skip to content

Commit

Permalink
working compile plus cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas committed Apr 24, 2011
1 parent da6ba1a commit 58c4d17
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
lib/*
target/*
*.class
55 changes: 25 additions & 30 deletions PolarUnravel.scm
@@ -1,13 +1,7 @@
;; compare with the original from ToxicLibs at http://toxiclibs.org/
;; note this is not good scheme code :D follows too many processing and java structures
;; and unlearned voodoo

(require 'list-lib)

;(define Map map) ; note that Processing's map conflicts, but not used here anyway


;; execute with: ./prokawa-toxi.sh -f ./PolarUnravel.scm

(define-simple-class PolarUnravel (processing.core.PApplet)
(transition :: java.lang.Float init-value: (make java.lang.Float 0.0) )
Expand All @@ -16,7 +10,8 @@
(col :: toxi.color.TColor )
(normUp :: toxi.geom.Vec2D )
((setup)
(size 680 382 codeanticode.glgraphics.GLConstants:GLGRAPHICS)
(size screenWidth screenHeight codeanticode.glgraphics.GLConstants:GLGRAPHICS)
(smooth)
)
((draw)
(background 255)
Expand All @@ -26,34 +21,34 @@
(set! transition (+ transition (* (- transTarget transition ) 0.01) ) )
(set! col (toxi.color.TColor:newHSV 0 1 1))
(set! normUp (make toxi.geom.Vec2D 0 -1))
(for-each (lambda (i :: gnu.math.IntNum )
(let* ((theta (radians i)))
(let* ((polar (make toxi.geom.Vec2D 100 theta)))
(col:setHue (modulo (/ (*:.y polar) TWO_PI) 1) )
(let* ((len (* (noise (* (*:.y polar) 4)) 100 )))
(let* ((circ ((polar:copy):toCartesian)))
(let* ((linear (make toxi.geom.Vec2D
(+ (/ (* (-
toxi.math.MathUtils:THREE_HALVES_PI
(*:.y polar)
) ww ) PI ) ww )
0) ))
(let* ((dir (circ:getNormalized)))
(circ:interpolateToSelf linear transition is)
((dir:interpolateToSelf normUp transition is):normalizeTo len)
(stroke (col:toARGB))
(line (*:.x circ) (*:.y circ) (+ (*:.x circ) (*:.x dir)) (+ (*:.y circ) (*:.y dir)) )
) ) ) ) ) ) )
(for-each
(lambda (i :: gnu.math.IntNum )
(let* ((theta (radians i)))
(let* ((polar (make toxi.geom.Vec2D 100 theta)))
(col:setHue (modulo (/ (*:.y polar) TWO_PI) 1) )
(let* ((len (* (noise (* (*:.y polar) 4)) 100 )))
(let* ((circ ((polar:copy):toCartesian)))
(let* ((linear (make toxi.geom.Vec2D
(+ (/ (* (- toxi.math.MathUtils:THREE_HALVES_PI
(*:.y polar)
) ww ) PI ) ww)
0) ))
(let* ((dir (circ:getNormalized)))
(circ:interpolateToSelf linear transition is)
((dir:interpolateToSelf normUp transition is):normalizeTo len)
(stroke (col:toARGB))
(line (*:.x circ) (*:.y circ) (+ (*:.x circ) (*:.x dir)) (+ (*:.y circ) (*:.y dir)) )
)))))))
(iota 180 270 2)
)
) )
))
)
((mousePressed)
(set! transTarget (+ transTarget 1))
(set! transTarget (modulo transTarget 2))
(set! transTarget (modulo (+ transTarget 1) 2) )
)
)

)
(define p (PolarUnravel) )
(PolarUnravel:runSketch (make String[] "--present" "PolarUnravel") p)

(processing.core.PApplet:main (make String[] "--present" "PolarUnravel"))

9 changes: 9 additions & 0 deletions PolarUnravel.sh
@@ -0,0 +1,9 @@
#!/bin/bash

./prokawa-toxi.sh --main -T go --module-static -C ./PolarUnravel.scm

export J=java
export CLASSPATH=./:./lib/toxiclibs/dist/colorutils.jar:./lib/toxiclibs/dist/toxiclibscore.jar:./target/prokawa-1.0-SNAPSHOT-jar-with-dependencies.jar:
export LIBPATH=/home/thomas/processing-1.5/modes/java/libraries/opengl/library/linux32/

$J -cp $CLASSPATH -Djava.library.path=$LIBPATH go
5 changes: 5 additions & 0 deletions pom.xml
Expand Up @@ -14,6 +14,11 @@
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.gnu</groupId>
<artifactId>kawa</artifactId>
Expand Down

0 comments on commit 58c4d17

Please sign in to comment.