Fixed fractals examples for imaginary unit plus minor changes - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/examples
diff options
context:
space:
mode:
authorfrancesco-ST <francesco.abbate@st.com>2011年05月10日 12:28:54 +0200
committerfrancesco-ST <francesco.abbate@st.com>2011年05月10日 12:28:54 +0200
commitd4da07d22762073e8ca84b5582a733c516fa9614 (patch)
treedff733714b3d0f7ce6021b7ac0da2b02f71fca68 /examples
parent233cdc0bcf8960ac5424c183e3fccc67aa3194c7 (diff)
downloadgsl-shell-d4da07d22762073e8ca84b5582a733c516fa9614.tar.gz
Fixed fractals examples for imaginary unit plus minor changes
Diffstat (limited to 'examples')
-rw-r--r--examples/fractals.lua 24
1 files changed, 7 insertions, 17 deletions
diff --git a/examples/fractals.lua b/examples/fractals.lua
index 41eeab40..71fdb224 100644
--- a/examples/fractals.lua
+++ b/examples/fractals.lua
@@ -2,11 +2,11 @@
use 'stdlib'
local function c_generator(n, n_angle, len_frac, g)
- local I, exp, real, imag = complex.I, complex.exp, complex.real, complex.imag
+ local exp, real, imag = complex.exp, complex.real, complex.imag
local w, r, k = ilist(|| 0, n+1), #g
local s = len_frac^n
- local sz = cnew(n_angle, 1, |k| s * exp(2*I*pi*(k-1)/n_angle))
+ local sz = cnew(n_angle, 1, |k| s * exp(2i*pi*(k-1)/n_angle))
local sh = ilist(|k| g[k%r+1] - g[(k-1)%r+1], 0, r-1)
local a = (g[1]*n) % n_angle
@@ -64,7 +64,6 @@ function demo1()
pl.units = false
pl:show()
- return pl
end
demo2 = function(n) return levyc(n and n or 6) end
@@ -94,8 +93,6 @@ function demo3()
pl.units = false
pitag_tree(pl, 0, 0, 0, 1, depth)
pl:show()
-
- return pl
end
function demo3bis(n)
@@ -122,7 +119,6 @@ function demo3bis(n)
local cfgen = color_function('darkgreen', 1)
local pl = plot()
- -- pl.units = false
pl:show()
for d=n, 0, -1 do
@@ -138,8 +134,6 @@ function demo3bis(n)
end
end
end
-
- return pl
end
function demo3ter(n)
@@ -165,7 +159,6 @@ function demo3ter(n)
pl.units = false
pl:show()
pitag_tree(pl, 0, 0, 0, 1, n)
- return pl
end
function demo4(n)
@@ -193,6 +186,7 @@ function demo4(n)
local pl = plot()
pl.sync = false
+ pl.clip = false
pl:show()
for k=0, n do
@@ -200,8 +194,6 @@ function demo4(n)
pitag_tree(pl, 0, 0, 0, 1, k)
pl:flush()
end
-
- return pl
end
function demo3q()
@@ -234,11 +226,9 @@ function demo3q()
cf = |k| cfgen(k/n)
pitag_tree(pl, 0, 0, 0, 1, 0)
- return pl
end
-echo([[
-demo1() - Von Koch's curve
-demo2() - Levy's C curve
-demo3() - Pythagorean Tree (symmetric)
-demo4() - Pythagorean Tree (asymmetric)]])
+echo 'demo1() - Von Koch\'s curve'
+echo 'demo2() - Levy\'s C curve'
+echo 'demo3() - Pythagorean Tree (symmetric)'
+echo 'demo4() - Pythagorean Tree (asymmetric)'
generated by cgit v1.2.3 (git 2.39.1) at 2025年10月02日 22:11:32 +0000

AltStyle によって変換されたページ (->オリジナル) /