-
-
Save mgdevereux/1c9743c97ec8a07e1b4d1c42e8b05e02 to your computer and use it in GitHub Desktop.
Revisions
-
OrganicIrradiation created this gist
Mar 23, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ s = (cos(s * pi - pi) + 1) / 2; This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ function s = noise3D (m,k) s = zeros([m,m,m]); w = m; i = 0; while w > 3 i = i + 1; d = smooth3(randn([m,m,m]), 'gaussian',k,i); s = s + i * d(1:m, 1:m, 1:m); w = w - ceil(w/2 - 1); end s = (s - min(min(s(:,:)))) ./ (max(max(s(:,:))) - min(min(s(:,:)))); end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ s = (s - min(min(s(:,:)))) ./ (max(max(s(:,:))) - min(min(s(:,:)))); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ function s = perlin (m) s = zeros(m); # output image w = m; # width of current layer i = 0; # iterations while w > 3 i = i + 1; d = interp2(randn(w), i-1, "spline"); s = s + i * d(1:m, 1:m); w -= ceil(w/2 - 1); end end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ function s = perlin2D (m) s = zeros([m,m]); % Prepare output image (size: m x m) w = m; i = 0; while w > 3 i = i + 1; d = interp2(randn([m,m]), i-1, 'spline'); s = s + i * d(1:m, 1:m); w = w - ceil(w/2 - 1); end s = (s - min(min(s(:,:)))) ./ (max(max(s(:,:))) - min(min(s(:,:)))); end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ function s = perlin3D (m) s = zeros([m,m,m]); % Prepare output image (size: m x m x m) w = m; i = 0; while w > 3 i = i + 1; d = interp3(randn([m,m,m]), i-1, 'spline'); s = s + i * d(1:m, 1:m, 1:m); w = w - ceil(w/2 - 1); end s = (s - min(min(s(:,:)))) ./ (max(max(s(:,:))) - min(min(s(:,:)))); end