designcoding
Search
About Table of Contents Keywords Support designcoding!

Parametric Curve Equations

September 19, 2021 | 4,292 views
Parametric Curves | Rhino Python
curve | equation | mathematics | parametric

The parametric curve equations are good examples to demonstrate the bridge between computer-aided design and mathematics. Although useless and pointless, it is a good exercise to extract the curve equations. In this Rhino Python code, I present a generalized equation extractor for Rhino. Rhino curves are good examples de Casteljau and Bézier curves. You can see the mathematical underpinnings of Rhino curves with this exercise:

from math import *
import rhinoscriptsyntax as rs
p = []
f = g = h = ""
d = rs.GetInteger("Enter degree ",3,1,7)
for i in range(d + 1):
	point = rs.GetPoint("Specify control point #"+str(i + 1))
	p.append(point)
	rs.AddPoint(point)
for i in range(d + 1):
	c = factorial(d)/(factorial(i)*(factorial(d-i)))
	f += "("+str(c)+"*((1-t)**("+str(d)+"-"+str(i)+"))*(t**"+str(i)+")*"+str(p[i][0])+")+"
	g += "("+str(c)+"*((1-t)**("+str(d)+"-"+str(i)+"))*(t**"+str(i)+")*"+str(p[i][1])+")+"
	h += "("+str(c)+"*((1-t)**("+str(d)+"-"+str(i)+"))*(t**"+str(i)+")*"+str(p[i][2])+")+"
f += "0"; g += "0"; h += "0"
print("These are the three (x,y,z) parametric equations of the curve")
print("f = "+f)
print("g = "+g)
print("h = "+h)
print("Now, testing the curve by plotting the equations within the domain (0,1)")
for i in range(0,100):
	t = i / 100
	point = [eval(f), eval(g), eval(h)]
	rs.AddPoint(point)

This code asks the user the degree of the curve. By default, Rhino’s curves are degree 3. Therefore, our default value is 3. After that, the script asks the user to specify the control points of the curve. The number of control points is always degree+1. More control points will require the decomposition of the curve into degree 3 spans. Maybe, I will post something about this later. After getting these data, the script starts building the equations.

The standard parametric curve has three equations; f, g, and h. These equations control the x, y, and z coordinates of the points on the curve. These equations are independent of each other, but all of them include one variable called t. This is the parameter, which is generally between 0 and 1. You need to plug the t value into these equations and calculate the x, y, and z coordinates. We build these equations as string values in the script.

Overall, we are constructing the Bernstein polynomial here. The line with “factorial” functions is called the “binomial” function. The other lines utilize the general Bernstein polynomials by plugging the coordinate values, the binomial coefficient, the degree, and other stuff. If you are interested in this part, I recommend looking at here. Finally, the script displays the three parametric curve equations and uses them to draw 100 points for verification.

parametric curve equations
  • Search

  • Categories

    • Education
      • Basic Design
      • Design Geometry
      • Design Mathematics
      • Digital Fabrication
      • Parametric Modeling
      • Tutorials
    • Philosophy
      • Analytical Tradition
      • Phenomenology
    • Practice
      • 3D Models
      • Projects
      • Publications
      • Workshops
    • Research
      • 3D Printing
      • Building Facade
      • Calculus
      • Climate Analysis
      • Compass Constructions
      • Computational Geometry
      • Curves
      • Decorative Arts
      • Digital Fabrication
      • Evolutionary Solvers
      • Folding Structures
      • Fractals
      • Graph Theory
      • Interlocking Structures
      • Islamic Patterns
      • Linear Algebra
      • Minimal Surfaces
      • Muqarnas
      • Non-Euclidean Geometry
      • Paneling
      • Parametric Curves
      • Parametric Objects
      • Parametric Surfaces
      • Pattern Deformations
      • Patterns
      • Pavilions
      • Polyhedra
      • Rammed Earth Structures
      • Robotic Fabrication
      • Shape Grammars
      • Simulation
      • Space Syntax
      • Surface Constructions
      • Tessellations
      • Tools
      • Vector Fields
      • Virtual Reality
    • Tools and Languages
      • 3DS Max
      • 3DS Max Script
      • Grasshopper
      • Photoshop
      • Physical Prototyping
      • Revit
      • Rhino
      • Rhino Macro
      • Rhino Python
      • Rhino Script
      • Unity
  • Monthly Archive

    • August 2026 (1)
    • October 2025 (1)
    • June 2025 (2)
    • May 2025 (2)
    • April 2025 (5)
    • December 2024 (40)
    • August 2024 (5)
    • July 2024 (6)
    • April 2024 (4)
    • March 2024 (10)
    • February 2024 (10)
    • January 2024 (8)
    • December 2023 (10)
    • August 2023 (3)
    • July 2023 (3)
    • June 2023 (7)
    • May 2023 (8)
    • April 2023 (7)
    • March 2023 (2)
    • February 2023 (2)
    • January 2023 (3)
    • December 2022 (6)
    • November 2022 (7)
    • January 2022 (1)
    • December 2021 (1)
    • October 2021 (3)
    • September 2021 (4)
    • August 2021 (4)
    • May 2019 (2)
    • April 2019 (1)
    • March 2019 (5)
    • January 2019 (2)
    • December 2018 (1)
    • November 2018 (4)
    • October 2018 (9)
    • July 2018 (1)
    • June 2018 (3)
    • May 2018 (1)
    • April 2018 (4)
    • February 2018 (2)
    • January 2018 (7)
    • August 2017 (9)
    • July 2017 (6)
    • October 2016 (1)
    • May 2015 (5)
    • April 2015 (8)
    • March 2015 (12)
    • February 2015 (4)
    • January 2015 (11)
    • November 2014 (1)
    • August 2014 (1)
    • June 2014 (2)
    • May 2014 (12)
    • April 2014 (5)
    • March 2014 (3)
    • February 2014 (6)
    • January 2014 (4)
    • December 2013 (5)
    • November 2013 (11)
    • October 2013 (2)
    • September 2013 (9)
    • August 2013 (4)
    • July 2013 (2)
    • June 2013 (14)
    • May 2013 (4)
    • April 2013 (10)
    • March 2013 (11)
    • February 2013 (11)
    • January 2013 (10)
    • December 2012 (10)
    • November 2012 (6)
    • October 2012 (13)
    • September 2012 (2)
    • August 2012 (5)
    • July 2012 (14)
    • June 2012 (6)
    • May 2012 (17)
    • April 2012 (15)
    • March 2012 (9)
    • February 2012 (16)
    • January 2012 (18)
    • December 2011 (20)
    • November 2011 (2)
  • Support designcoding!

    Enjoying designcoding? Support its future with a small donation on Patreon. Thank you!

    Patreon


    copyright 2026 designcoding.net | about | table of contents | keywords | privacy policy | end user license agreement