""" # -*- coding: utf-8 -*- ###mit Kreisen am Boden import rhinoscriptsyntax as rs import math allobjs = rs.AllObjects() rs.DeleteObjects(allobjs) s = 137.508 # Phyllotaxis-Winkel (goldener Winkel in Grad) num_points = 500 # Anzahl der Punkte (Samen/Kreise) radius = 0.3 # Radius der Kreis 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) # Parameter s = 137.508 # Phyllotaxis-Winkel (goldener Winkel in Grad) num_points = 500 # Anzahl der Punkte radius = 0.3 # Radius der Kreise z_increment = 0.1 # Z-Schritt pro Punkt 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_increment # Z-Koordinate steigt proportional zu n # Kreis erzeugen position = [x, y, z] #################################################################### """ #mit würfel # -*- 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 = 500 # Anzahl der Punkte base_cube_size = 2 # Größe der Würfel z_increment = -0.05 # Z-Schritt pro scaling_factor = 0.1 # Faktor zur Beeinflussung der Größenänderung 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_increment # 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 rs.AddBox([corner1, corner2, corner3, corner4, corner5, corner6, corner7, corner8]) """ import rhinoscriptsyntax as rs import random as ran import flipped_classroom_lib as fc reload(fc) rs.DeleteObjects(rs.AllObjects()) ############################################################### # Your Panel functions... ############################################################### def my_panel(points, scale): #rs.AddSrfPt(points) (P0,P1,P2,P3) = points rs.AddLine(P0,P2) d_cen1 = rs.VectorDivide(rs.VectorAdd(P0,P2),2) rs.AddPoint(d_cen1) rs.AddLine(P1,P3) d_cen2 = rs.VectorDivide(rs.VectorAdd(P1,P3),2) rs.AddPoint(d_cen2) center_pt = rs.VectorDivide(rs.VectorAdd(d_cen1,d_cen2),2) rs.AddPoint(center_pt) if not(rs.PointCompare(d_cen1,d_cen2)): rs.AddLine(d_cen1,d_cen2) vec1 = rs.VectorSubtract(P0, center_pt) vec2 = rs.VectorSubtract(center_pt, P3) normal = rs.VectorCrossProduct(vec1, vec2) u_normal = rs.VectorUnitize(normal) su_normal = rs.VectorScale(u_normal, scale) normal_pt = rs.VectorAdd(center_pt, su_normal) rs.AddPoint(normal_pt) rs.AddLine(center_pt, normal_pt) rs.AddSrfPt([P0, normal_pt, P1]) rs.AddSrfPt([P1, normal_pt, P2]) rs.AddSrfPt([P2, normal_pt, P3]) rs.AddSrfPt([P3, normal_pt, P0]) ############################################################### rs.EnableRedraw(False) quad = [[0,0,0], [10,0,0], [10,0,12], [0,0,12]] quad = [[0,0,0], [10,4,0], [10,4,12], [0,0,12]] result_list = fc.PEF_single_face(quad) p_list = result_list[0] # Pointlist, contains single points e_list = result_list[1] # Horizontal Edgelist, contains lists with two points ve_list = result_list[2] # Vertical Edgelist, contains lists with two points f_list = result_list[3] # Facelist, contans lists with four points (quads) zcol = result_list[4] # number of levels of faces xcol = result_list[5] # number of faces in one level print "there are " + str(len(p_list)) + " points and " + str(len(f_list)) + " faces on " + str(zcol) + " levels, "+str(xcol)+" per level!" if 1: for i in range(zcol): for j in range(xcol): points = f_list[i*xcol+j] scale = ran.uniform(0.5, 8.5) my_panel(points, scale) #rs.AddSrfPt(f_list[i*xcol+j]) rs.EnableRedraw(True) """