forked from inconvergent/weird
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2rnd.lisp
70 lines (55 loc) · 1.64 KB
/
2rnd.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
(in-package :rnd)
(veq:vdef* 2on-line ((:varg 2 a b))
(declare #.*opt* (veq:ff a b))
(veq:f2from a (veq:f2- b a) (rnd)))
(veq:vdef* 2non-line (n (:varg 2 a b))
(declare #.*opt* (weird:pos-int n) (veq:ff a b))
(veq:fwith-arrays (:n n :itr k
:arr ((arr 2))
:fxs ((f () (2on-line a b)))
:exs ((arr k (f))))
arr))
(veq:vdef* 2in-rect ((:varg 2 s))
(declare #.*opt* (veq:ff s))
(values (rnd* (:vref s 0)) (rnd* (:vref s 1))))
(veq:vdef* 2in-square (s)
(declare #.*opt* (veq:ff s))
(2in-rect s s))
(veq:vdef* 2nin-rect (n (:varg 2 s))
(declare #.*opt* (weird:pos-int n) (veq:ff s))
(veq:fwith-arrays (:n n :itr k
:arr ((a 2))
:fxs ((f () (2in-rect s)))
:exs ((a k (f))))
a))
(veq:vdef* 2nin-square (n s)
(declare #.*opt* (weird:pos-int n) (veq:ff s))
(veq:fwith-arrays (:n n :itr k
:arr ((a 2))
:fxs ((f () (2in-square s)))
:exs ((a k (f))))
a))
(veq:vdef* 2on-circ (rad)
(declare #.*opt* (veq:ff rad))
(veq:f2scale (veq:fcos-sin (rnd veq:fpii)) rad))
(veq:vdef* 2non-circ (n rad)
(declare #.*opt* (veq:ff rad))
(veq:fwith-arrays (:n n :itr k
:arr ((a 2))
:fxs ((f () (2on-circ rad)))
:exs ((a k (f))))
a))
(veq:vdef* 2in-circ (rad)
(declare #.*opt* (veq:ff rad))
(let ((a (rnd)) (b (rnd)))
(declare (veq:ff a b))
(if (< a b) (setf a (* veq:fpii (/ a b)) b (* b rad))
(let ((d a)) (setf a (* veq:fpii (/ b a)) b (* d rad))))
(values (* (cos a) b) (* (sin a) b))))
(veq:vdef* 2nin-circ (n rad)
(declare #.*opt* (veq:ff rad))
(veq:fwith-arrays (:n n :itr k
:arr ((a 2))
:fxs ((f () (2in-circ rad)))
:exs ((a k (f))))
a))