Skip to content

Commit 4c3170a

Browse files
committed
Flower
1 parent c52735e commit 4c3170a

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

README.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GoldenSequences.jl
22
Generalized golden sequences, a form of low discrepancy sequence or quasi random numbers
3-
See [Martin Roberts: The Unreasonable Effectiveness
3+
See [Martin Roberts: The Unreasonable Effectiveness
44
of Quasirandom Sequences](http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/) for background.
55

66
Golden sequence
@@ -35,6 +35,14 @@ julia> collect(take(GoldenSequence(0.0), 10))
3535
0.5623058987490541
3636
```
3737

38+
Random colors: Low discrepancy series are good choice for (quasi-) random colors
39+
```
40+
using Colors
41+
n = 20
42+
c = map(x->RGB(x...), (take(GoldenSequence(3), n))) # perfect for random colors
43+
```
44+
45+
3846
2D golden sequence
3947
==================
4048

@@ -65,3 +73,18 @@ GoldenSequence(n::Int) # Float64 n-dimensional golden sequence
6573
GoldenSequence(x0::Number) # 1-d golden sequence shifted by `x0`
6674
GoldenSequence(x0) # length(x)-d golden sequence shifted/starting in 'x0'
6775
```
76+
77+
78+
A flower
79+
========
80+
Flower petals grow in spots not covering older petals, the new spot is at an angle given by the golden sequence.
81+
82+
```
83+
using Colors
84+
using Makie
85+
n = 20
86+
c = map(x->RGB(x...), (take(GoldenSequence(3), n))) # perfect for random colors
87+
x = collect(take(GoldenSequence(0.0), n))
88+
petals = [(i*cos(2pi*x), i*sin(2pi*x)) for (i,x) in enumerate(x)]
89+
scatter(reverse(petals), color=c, markersize=10*(n:-1:1))
90+
```

flower.png

81.3 KB
Loading

randomcolors.png

16.5 KB
Loading

0 commit comments

Comments
 (0)