Fractals is a plugin for Grasshopper that allows users to create 3 different types of mathematically generated fractals.

Download the Fractals Plugin here

These fractals are derived from the following mathematically generated patterns:

L-System

Sunflower

DLA

Installation steps:

Step 1: Extract all files to a folder on your Desktop.
Step 2: Open Rhinoceros and run Grasshopper.
Step 3: Click on File > Special Folders > Components Folder .
Step 4: Copy “Fractals.gha”, “Fractals.pdb” and “Fractals.xml” from extraxted folder on your desktop.
Step 5: Paste these files in the Components Folder (usually named “Libraries”).
Step 6: Close everything and restart Rhino, run Grasshopper. The plugin tab “Fractals” should appear with 3 components.

For a better understanding of how these components work, visit:
https://www.codeproject.com/Articles/650821/Fractals-in-theory-and-practice

Sunflower Component Solve Algorithm:

        Dim Angle As Double = 0
        Dim R As Double = 0
        Dim c As Double = 0
        Dim pc As New List(Of Point)
        Dim radii As New List(Of Double)
        Dim x As Double = 0
        Dim y As Double = 0
        Dim numberofseeds As Integer = 3000
        Dim initial As New Point3d(0, 0, 0)
        Dim degree As Int32 = 5
        Dim trans As New Vector3d
        If (Not DA.GetData(0, numberofseeds)) Then Return
        If (Not DA.GetData(1, initial)) Then Return
        If (Not DA.GetData(2, degree)) Then Return
        If (degree <= 1) Then
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Degree must be greater than 1.")
                Return
        End If
        If (((Math.Sqrt(degree)) - (Math.Floor(Math.Sqrt(degree)))) = 0) Then
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Degree must not be a perfect square.")
                Return
        End If
        c = (Math.Sqrt(degree) + 1) / 2
        For i As Integer = 0 To numberofseeds
                R = i ^ c / (numberofseeds / 2)
                Angle = 2 * Math.PI * c * i
                x = initial.X + (R * Math.Sin(Angle) + (numberofseeds / 10))
                y = initial.Y + (R * Math.Cos(Angle) + (numberofseeds / 10))
                Dim p As New Point(New Point3d(x, y, initial.Z))
                If i = 0 Then
                        Dim l As New Line(initial, p.Location)
                        trans = ((l.UnitTangent * l.Length) * (-1))
                End If
                p.Translate(trans)
                pc.Add(p)
                Dim rad As Double = 0
                rad = i / (numberofseeds / 10)
                radii.Add(rad)
        Next
        DA.SetDataList("Radius", radii)
        DA.SetDataList("Points", pc)

L-System [Turtle] Solve Algorithm:

        Dim OutputPoints As New List(Of Point3d)
        Dim OutputLines As New List(Of Line)

        Dim StartPoint As New Point3d(0.0, 0.0, 0.0)
        Dim GenerationCode As String = "-F-F-F-F-F-F"
        Dim Iterations As Int32 = 3000
        Dim Angle As Double = 60.0
        Dim Length As Double = 10.0

        If (Not DA.GetData(0, StartPoint)) Then Return
        If (Not DA.GetData(1, GenerationCode)) Then Return
        If (Not DA.GetData(2, Iterations)) Then Return
        If (Not DA.GetData(3, Angle)) Then Return
        If (Not DA.GetData(4, Length)) Then Return

        If (GenerationCode = "") Then
                AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No Code to Run!")
                Return
        End If

        Dim TurtleLocation As Point3d = StartPoint
        Dim TurtleDirection As Double = 0.0
        Dim LastLocation As Point3d = TurtleLocation
        For x As Int32 = 0 To Iterations
                For Each Character As Char In GenerationCode
                        Select Case Character
                                Case ("F").ElementAt(0)
                                        If x = 0 Then
                                                OutputPoints.Add(TurtleLocation)
                                        End If
                                        LastLocation = TurtleLocation
                                        TurtleLocation.X = TurtleLocation.X + (Length * (Math.Cos(TurtleDirection)))
                                        TurtleLocation.Y = TurtleLocation.Y + (Length * (Math.Sin(TurtleDirection)))
                                        OutputPoints.Add(TurtleLocation)
                                        Dim line As New Line(LastLocation, TurtleLocation)
                                        OutputLines.Add(line)
                                Case ("f").ElementAt(0)
                                        TurtleLocation.X = TurtleLocation.X + (Length * (Math.Cos(TurtleDirection)))
                                        TurtleLocation.Y = TurtleLocation.Y + (Length * (Math.Sin(TurtleDirection)))
                                Case ("-").ElementAt(0)
                                        TurtleDirection = TurtleDirection - Angle
                                Case ("+").ElementAt(0)
                                        TurtleDirection = TurtleDirection + Angle
                                Case Else
                                        AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Error in Code!")
                                        Return
                        End Select
                Next
        Next

        DA.SetDataList(0, OutputPoints)
        DA.SetDataList(1, OutputLines)

DLA (Diffusion Limited Aggregation Fractal a.k.a. Drunken Man Fractal) Solve Algorithm:

        Dim iterations As Int32 = 3000
        Dim Start As New Point3d(0, 0, 0)
        Dim M As Double = 1.0
        Dim h As Double = 100.0
        Dim w As Double = 100.0
        Dim loopcanvas As Boolean = True
        If (Not DA.GetData(0, iterations)) Then Return
        If (Not DA.GetData(1, Start)) Then Return
        If (Not DA.GetData(2, M)) Then Return
        If (Not DA.GetData(3, h)) Then Return
        If (Not DA.GetData(4, w)) Then Return
        If (Not DA.GetData(5, loopcanvas)) Then Return
        If (h <= (M * 10)) Then
            AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Height must be greater than Multiplier x 10.")
            Return
        End If
        If (w <= (M * 10)) Then
            AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Width must be greater than Multiplier x 10.")
            Return
        End If
        Dim cp As Point3d = Start
        Dim points As New List(Of Point)
        For x As Int32 = 0 To iterations
            points.Add(New Point(cp))
            cp = MoveToNeighbor(cp, h, w, M, loopcanvas)
        Next
        DA.SetDataList(0, points)

Made using Microsoft Visual Studio 2017, Rhino and Grasshopper SDK v6
Tested only on Rhino 6 BETA and the in-built Grasshopper plugin
Use at your own risk

Also available on Food4Rhino here.

Thank you!