designcoding
About Table of Contents Keywords Monthly Archive
Support designcoding!

Fractal Curves with Rhino Python

July 31, 2017 | Algorithms
#fractal #gosper-curve #parametric-curve #rhino-python

A simple Rhino Python script that generates fractal curves. An example is a test with the Gosper-Peano curve. However the script is not supporting segment directions, which is why the result is not the intended curve. Curve directions could be implemented in the future.

Fractal Curves with Rhino Python fractal, gosper-curve
# Drawing Simple Fractal Curves
# 31.07.2017 www.designcoding.net - Tugrul Yazar
import rhinoscriptsyntax as rs
import copy

initials = rs.GetObject("Select Initial Shape", 4)
referenceA = rs.GetPoint("Place Reference Point A")
referenceB = rs.GetPoint("Place Reference Point B")
iteration = rs.GetInteger("Enter Number of Iterations", 3, 1, 10)

if initials and referenceA and referenceB and iteration:
	if rs.CurveDegree(initials) > 1:
		rs.RebuildCurve(initials, 1)
	shape = []
	shape.append(initials)
	for i in range(iteration):
		segments = rs.ExplodeCurves(shape)
		rs.HideObjects(shape)
		new = []
		for segment in segments:
			starts = rs.CurveStartPoint(segment)
			ends = rs.CurveEndPoint(segment)
			newsegment = rs.OrientObject(initials, [referenceA, referenceB], [starts, ends], 3)
			new.append(newsegment)
		shape = copy.deepcopy(new)
		rs.HideObjects(segments)
	rs.ShowObjects(shape)
else:
	print "Nothing done. One or more inputs were not defined"

Python file (PY)Download

Cite this post

Yazar, T. (2017, July 31). Fractal Curves with Rhino Python. designcoding. Retrieved August 24, 2026, from https://www.designcoding.net/fractal-curves-with-rhino-python/

Related Posts

Gosper-Peano Fractal Curves

January 8, 2018

Introducing the new YouTube channel for designcoding! The architectural Geometry playlist will contain video tutorials on several topics of basic geometry exercises for designers. Below are the introductory exercises of polyline drawing and some planar transformations such as scale and rotation. It is also an interesting plane-filling fractal you know I like it very much. I studied this particula fractal (Gosper-Peano) earlier here, and here. I find it very inspiring and educational.

Gosper-Peano Curve in Grasshopper

August 19, 2017

Anemone components are still working great, extending the abilities of Grasshopper. Here, I studied a space-filling (or plane-filling) fractal called the Gosper-Peano Curve. You should be very careful about the number of iterations (the N input). Because it can crash your Rhino if you change it to more significant numbers. Also, you should have Anemone components installed in order to run this definition. The generator curve is a special one. This website explains the generation of the curve from the…

Drawing Gosper Curve

December 10, 2024

The Flowsnake, or Gosper curve is a space-filling fractal. It is also known as the Peano-Gosper curve. There are other similar space-filling fractals such as the Dragon curve, or the Hilbert curve. A space-filling fractal is a special type of curve, that fills a plane when iterated infinitely. This means, that if you continue to replace every segment of the polyline with the whole drawing, it will quickly become very dense and ultimately fill the plane without any gaps or…

Drawing Gosper Unit

December 10, 2024

In computer-aided design (CAD), a polyline is a series (or a chain) of straight lines. Each straight section of a polyline is a “segment,” and the points where the segments connect are “vertices.” If a polyline’s starting and ending vertices coincide, it is a “closed polyline” or a “polygon”. If they do not, the polyline is classified as an “open polyline.” Polylines can be planar (2D) or 3D. The Gosper curve, named after Bill Gosper, also known as the Peano-Gosper…

Discrete Fourier Transform

May 8, 2025

The Fourier Transform is a powerful mathematical technique that allows us to analyze the different frequency components within a signal or shape. Its discrete version, the Discrete Fourier Transform (DFT), is used when working with numerical data. I studied the Fourier Series here before. One of the most fascinating aspects of the DFT is that it can represent a signal or shape using rotating circles (or vectors). Each circle corresponds to a specific frequency, amplitude, and phase. When connected in…

  • Chapters

    • Algorithms
    • Discourses
    • Fabrications
    • Studios
  • Explore

    • All Keywords
    • Table of Contents
    • Monthly Archive
    • #grasshopper
    • #tutorial
    • #rhinoceros
    • #bezier-curve
    • #polyhedra
    • #dome
    • #design-object
    • #simulation
    • #hilbert
    • #polygon
    • #b-spline
    • #anemone
    • #catenary
    • #design-education
    • #linear-algebra
    • #dual
    • #art
    • #image-sampler
    • #growth
    • #vector-field
  • Search

  • Support designcoding!

  • Enjoying designcoding? Support me on Patreon to keep it growing. Thank you!

  • copyright 2026 designcoding.net | about | privacy policy | end user license agreement