# -*- coding: utf-8 -*- import rhinoscriptsyntax as rs import math # Alle Objekte in der Szene löschen allobjs = rs.AllObjects() if allobjs: rs.DeleteObjects(allobjs) # Parameter s = 137.508 # Phyllotaxis-Winkel (goldener Winkel in Grad) num_points = 750 # Anzahl der Punkte base_cube_size = 2 # Größe der Würfel z_distance = -0.05 # Z-Achse nach oben scaling_factor = 0.1 # Faktor zur Beeinflussung der Größenänderung pts_list=[] for n in range(num_points): # Berechnung der Polar-Koordinaten angle = math.radians(n * s) # Winkel in Bogenmaß distance = math.sqrt(n) # Radialer Abstand # Kartesische Koordinaten berechnen x = distance * math.cos(angle) # X-Koordinate y = distance * math.sin(angle) # Y-Koordinate z = n * z_distance # Z-Koordinate steigt proportional zu n # Würfelgröße basierend auf der Z-Koordinate anpassen # Je negativer z, desto größer wird der Würfel cube_size = base_cube_size + abs(z) * scaling_factor # Eckpunkte des Würfels definieren half_size = cube_size / 2 third_size=cube_size/3 corner1 = [x - half_size, y - half_size, z - half_size] corner2 = [x + half_size, y - half_size, z - half_size] corner3 = [x + half_size, y + half_size, z - half_size] corner4 = [x - half_size, y + half_size, z - half_size] corner5 = [x - third_size, y - third_size, z + half_size] corner6 = [x + third_size, y - third_size, z + half_size] corner7 = [x + third_size, y + third_size, z + half_size] corner8 = [x - third_size, y + third_size, z + half_size] # Würfel erstellen cube = rs.AddBox([corner1, corner2, corner3, corner4, corner5, corner6, corner7, corner8]) #rs.RotateObjects(cube,[x,y,z],angle,[0,0,1])