Testing Waters
  • Scrapbook
  • Projects
    • Bamiyan Cultural Center
    • Bauhaus Museum
    • Better Hebbal
    • Bicycle Station
    • Cross Laminated Timber
    • Facade
    • Flowing Fabrication
    • Form from Images
    • Guggenheim Helsinki
    • National War Museum
    • National War Memorial
    • Indflorescence
    • Rectangular Compartments
    • Retail Space Layout
    • Noise Barrier : Swedevia Airport
    • Walden
    • Wilson Garden
  • Patterns
    • Area Graph
    • Array along Curve
    • Fibbonacci and Factorial
    • Gyroid
    • Hexagonal Pattern From Image
    • Hexagonal Grid
    • Koch Star
    • Mandelbrot Set
    • Pattern
    • Pattern
    • Pattern
    • Phyllotaxis
    • Random Strip Widths
    • Skewed Surface
    • Staggered Checkerboard
    • Triangle subdivision
    • Vector Field
    • Voronoi
    • Waves
    • Weave
  • Geometry
    • Boundary Curve
    • Bridging parallel curves
    • British Museum Great Court
    • Catenary
    • Delete Adjacent
    • Geodesic Sphere
    • Group Branching Curves
    • Group Circles
    • Group curves
    • K Mean
    • Nurbs Surface Irregular
    • Overlapping Petals
    • Pair Nearest
    • Parametric Shapes
    • Platonic Solids
    • Polyline to PolyArc
    • Roman Surface
    • Sagrada Familia Schools Roof
    • Sine Curve
    • Sine Ribbon
    • Spherical Transformations
    • Split Rectangle
    • Tangential Circle through Point
    • Travelling Salesman Problem
    • Unaligned Bounding Box
  • Lists
    • Alter by Boolean Sequence
    • Color by distance
    • Consecutive Points
    • Distancing
    • Divide Equally
    • Geometry from Image
    • Image based Point Density
    • Isovists
    • Reduce Color Palette
    • Replace Consecutive
    • Replace Multiple
    • Replace Recurring
    • Shadow Area
    • Shortest Path
    • Solar Analysis
    • Topography Analysis
  • Motion
    • Adjacency
    • Animate Sphere
    • Cellular Automation
    • Cloth
    • Hypotrochoid
    • Manakin
    • Rolling Spiral
    • Tan Curve
    • Trammel of Archemedes
    • Image to Integer
  • Articles
    • A Conceptual Approach to Integrating Computational Methods in Early Stage Design
    • Design Script's ambiguous and versatile Replication Guides <1>
    • Design Script's ambiguous and versatile Replication Guides <2>
Powered by GitBook
On this page
  • Pisano Period
  • Fibbonacci Series
  • Factorials
  1. Patterns

Fibbonacci and Factorial

Recursive functions in Design Script

PreviousArray along CurveNextGyroid

Last updated 4 years ago

Pisano Period

wc = 20;
hc = 12;
wd = 2;
ht = 2;

//Pisano Period
fp1 = fibbonacci(1..wc)%(1..hc)<1>;

//Random Colors
uq1 = List.UniqueItems(List.Flatten(fp1,-1));
rn1 = Math.Round(Math.RemapRange(Math.RandomList(List.Count(uq1)),0,255));
cl1 = Color.ByARGB(255,rn1,List.Shuffle(rn1),List.Reverse(rn1));
cl2 = Dictionary.ByKeysValues(uq1+"",cl1).ValueAtKey(fp1+"");

//Panels
pn1 = Rectangle.ByWidthLength(Plane.ByOriginNormal(Point.ByCoordinates((wd/2..#wc..wd),0,(ht/2..#hc..ht)<2>),Vector.YAxis()),wd,ht).Patch();
pn2 = GeometryColor.ByGeometryColor(pn1,cl2);

Fibbonacci Series

def fibbonacci(n)
{
    return [Imperative]
    {
	    if (n == 0)
	    {
	    	return 0;
	    }
	    elseif (n == 1)
	    {
	    	return 1;
	    }
	    else
	    {
	    	return (fibbonacci(n-1) + fibbonacci(n-2));
	    }
	}
};

Factorials

def factorial(n)
{
    return [Imperative]
    {
	    if (n <= 1)
	    {
	    	return 1;
	    }
	    else
	    {
	    	return n * factorial(n-1);
	    }
	}
};

2KB
pisanoPeriod.zip
archive
Dynamo Version 2.11
Random colors based on Pisano Period
Pisano Period
Fibbonacci
Factorial