Permalink
Browse files

Fix example (No framerate yet)

  • Loading branch information...
1 parent 12068fc commit ff986250b63826179ed9a32ce679379eb22f7583 @dardoria committed Jul 26, 2011
Showing with 41 additions and 10 deletions.
  1. +6 −7 examples/formandcode/repeat-recursive-tree.lisp
  2. +1 −1 graphics.lisp
  3. +4 −1 package.lisp
  4. +2 −1 ponon.asd
  5. +28 −0 utils.lisp
@@ -18,8 +18,8 @@
(in-package :formandcode-examples)
-(defparameter *angle-offset-a* 1.5)
-(defparameter *angle-offset-b* 50)
+(defparameter *angle-offset-a* (radian 1.5))
+(defparameter *angle-offset-b* (radian 50))
(defclass repeat-recursive-tree (base-app)
((dot-size :accessor dot-size :initform 9)))
@@ -30,14 +30,13 @@
(defmethod draw ((app repeat-recursive-tree))
(set-background 1 1 1)
(set-color 0 0 0)
- ;;(gl:translate (/ (window-width app) 2) (window-height app) 0)
- (seed1 (dot-size app) 270 0 0))
-
+;; (gl:translate (/ (window-width app) 2) (window-height app) 0)
+ (seed1 (dot-size app) (radian 270) (/ (window-width app) 2) (window-height app)))
(defun seed1 (dot-size angle x y)
(when (> dot-size 1)
;; Create a random number between 0 and 1
- (let ((r (/ (random 100) 100)))
+ (let ((r (random 1.0)))
(cond ((> r 0.02) ;;98% chance this will happen
(draw-circle x y dot-size)
(let ((newx (+ x (* (cos angle) dot-size)))
@@ -54,7 +53,7 @@
(defun seed2 (dot-size angle x y)
(when (> dot-size 1)
- (let ((r (/ (random 100) 100)))
+ (let ((r (random 1.0)))
(cond ((> r 0.05);;95% chance this will happen
(draw-circle x y dot-size)
(let ((newx (+ x (* (cos angle) dot-size)))
View
@@ -2,7 +2,7 @@
;;;
;;; graphics.lisp --- Ponon graphics interface
;;;
-;;; Copyright (c) 2010, Boian Tzonev <boiantz@gmail.com>
+;;; Copyright (c) 2010-2011, Boian Tzonev <boiantz@gmail.com>
;;;
;;; Permission is hereby granted, free of charge, to any person obtaining a copy
;;; of this software and associated documentation files (the "Software"), to deal
View
@@ -1,3 +1,4 @@
+
;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
;;;
;;; package.lisp --- Ponon package definition and exports
@@ -69,4 +70,6 @@
#:draw-circle
#:draw-arc
#:draw-polygon
- #:draw-curve))
+ #:draw-curve
+ ;;utils
+ #:radian))
View
@@ -31,5 +31,6 @@
:components ((:file "package")
(:file "app" :depends-on ("package"))
(:file "window" :depends-on ("package"))
- (:file "graphics" :depends-on ("package"))))
+ (:file "graphics" :depends-on ("package"))
+ (:file "utils" :depends-on ("package"))))
View
@@ -0,0 +1,28 @@
+;;; -*- Mode: Lisp; indent-tabs-mode: nil -*-
+;;;
+;;; utils.lisp --- Ponon utils
+;;;
+;;; Copyright (c) 2011, Boian Tzonev <boiantz@gmail.com>
+;;;
+;;; Permission is hereby granted, free of charge, to any person obtaining a copy
+;;; of this software and associated documentation files (the "Software"), to deal
+;;; in the Software without restriction, including without limitation the rights
+;;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+;;; copies of the Software, and to permit persons to whom the Software is
+;;; furnished to do so, subject to the following conditions:
+;;;
+;;; The above copyright notice and this permission notice shall be included in
+;;; all copies or substantial portions of the Software.
+;;;
+;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+;;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+;;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+;;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+;;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+;;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+;;; THE SOFTWARE.
+
+(in-package :ponon)
+
+(defun radian (degree)
+ (* degree (/ PI 180)))

0 comments on commit ff98625

Please sign in to comment.