## Computational Geometry »

Anemone components are still working great, extending the abilities of Grasshopper. Here, I studied a space-filling fractal called Gosper-Peano curve. You can download the Grasshopper definition here. Be very careful about the number of iterations (the N input) because it can crash your Rhino if you change it to bigger numbers. Also you should have Anemone components installed in order to run this definition. The generator curve is a special one. Direction, length and angle of every segment make it possible to create this beautiful fractal. I love to use […]

Studied earlier in Grasshopper here, creating a cycloid-like curve actually mimics the physical process of rotating disks on a path. Below is a test in Rhino Python. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 # Drawing Cycloid-like Curves # 07.08.2017 www.designcoding.net – Tugrul Yazar import rhinoscriptsyntax as rs curv = rs.GetObject("Select curve") qual = rs.GetInteger("Quality",100) radi = rs.GetReal("a radius",4) radi2 = rs.GetReal("Circle radius",4) cua = rs.OffsetCurve(curv,[1,1,0],radi2) cevre = 2 * 3.1415 * radi mimi = [] […]

This Rhino Python script generates the dual of the selected solid object. However it has some bugs and is not working in some cases. This task could be much better solved with meshes because the main problem is to identify the neighbourhoods of faces. Works pretty well with simple objects like boxes. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 # Generating Dual of Selected Polyhedron # 03.08.2017 www.designcoding.net – Tugrul […]

Again, another example of utilizing Rhino Python for educational purposes and especially for designers. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 # Drawing Simple Polygon Fractals # 02.08.2017 www.designcoding.net – Tugrul Yazar import rhinoscriptsyntax as rs centerPoint = rs.GetPoint("Specify the center of polygon") numberEdges = rs.GetInteger("Enter the number of edges", 6, 3) radius = rs.GetReal("Specify the radius of polygon", 10) iterat = rs.GetInteger("Enter the number of iterations", […]

A simple Rhino Python script that generates fractal curves. Example is the test with Gosper-Peano curve. However the script is not supporting segment directions, that is why the result is not the intended curve. Curve directions could be implemented in the future. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 # Drawing Simple Fractal Curves # 31.07.2017 www.designcoding.net – Tugrul Yazar import rhinoscriptsyntax as rs import copy initials = rs.GetObject("Select Initial […]

Studied earlier in Grasshopper here, the sunflower spiral or Phyllotaxis, or Fermat’s spiral could be drawn as an exercise of looping in Rhino Python. 1 2 3 4 5 6 7 8 9 10 # Drawing the Fermat’s Spiral with Circles # 30.07.2017 www.designcoding.net – Tugrul Yazar import rhinoscriptsyntax as rs import math s = 137.508 for n in range(0,500): t = math.sqrt(n) g = n * s z = rs.Polar([0,0,0],g,t) rs.AddCircle(z,0.3)# Drawing the Fermat’s Spiral with Circles # 30.07.2017 www.designcoding.net – Tugrul Yazar import rhinoscriptsyntax as rs import math […]

Video showing the method to draw variable stellations of an icosahedron. For more information, visit here. You can search for “icosahedron” in designcoding to see the construction of it.

1 2 3 4 5 6 7 8 9 10 11 12 13 # Drawing the Convex Hull of Given Points # 28.07.2017 www.designcoding.net – Tugrul Yazar import rhinoscriptsyntax as rs points = rs.GetPointCoordinates("Select points") a = min(points) start = a while a: o = a a = points[0] for b in points: if (a[0]-o[0])*(b[1]-o[1])-(a[1]-o[1])*(b[0]-o[0]) < 0: a = b rs.AddLine(o,a) if a == start: break# Drawing the Convex Hull of Given Points # 28.07.2017 www.designcoding.net – Tugrul Yazar import rhinoscriptsyntax as rs points = rs.GetPointCoordinates("Select points") a = min(points) […]

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 # Delaunay Triangulation of Given Points # 27.07.2017 www.designcoding.net – Tugrul Yazar import rhinoscriptsyntax as rs from itertools import combinations as cb points = rs.GetObjects("Select points for Delaunay Triangulation", 1) set = list(cb(points,3)) for tuple in set: c1 = rs.PointCoordinates(tuple[0]) c2 = rs.PointCoordinates(tuple[1]) c3 = rs.PointCoordinates(tuple[2]) if (c1[0]-c2[0])*(c3[1]-c2[1])-(c1[1]-c2[1])*(c3[0]-c2[0]) != 0: circle = rs.AddCircle3Pt(tuple[0],tuple[1],tuple[2]) delaunay = 0 for point in points: if rs.PointInPlanarClosedCurve(point,circle) == 1: delaunay = 1 continue if delaunay == […]

Exercising the “folding” process of a nine-faced solid. Start from its net, analyze the matching edges. Then, use sphere intersections to calculate the rotation angles. Visit here for more information about this solid: http://aperiodical.com/2013/10/an-enneahedron-for-herschel/

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 # Draw centered hexagonal grid # 25.07.2017 www.designcoding.net – Tugrul Yazar import rhinoscriptsyntax as rs import math hexGridCenter = rs.GetPoint("Specify center point") hexGridExtend = rs.GetInteger("Enter the number of radial levels", 3, 2) hexGridClSize = rs.GetReal("Edge size of hexagons", 1.0) hexGridCAngle = rs.GetReal("Rotation angle of hexagons", 0.0) edges = 6 rs.AddPoint(hexGridCenter) hexGrid = [] pythagoras = 2 * math.sqrt((hexGridClSize * hexGridClSize) – […]