#Thomas Poelzl-Hausuebung 4 import rhinoscriptsyntax as rs import random, time, sys rs.EnableRedraw(0) #1 if 1: iAnz = 5000 iRad = 3 center = [16,-5,0] deltaAngle = 360/iAnz vec = [1, 1, 1] for i in range(iAnz): angX = deltaAngle*i vecX = rs.VectorRotate( vec, angX , [random.uniform(-1,1),random.uniform(-1,1),random.uniform(-1,1)]) vecX = rs.VectorScale( vecX, random.uniform( 3,iRad) ) vecX = rs.VectorAdd( vecX, center) rs.AddPoint( vecX ) Sph1=rs.AddPoint(vecX) rs.ObjectColor(Sph1, [random.uniform(1,200), random.uniform(1,200),random.uniform(1,200)]) #2 if 1: iAnz2 = 5000 iRad2 = 3.5 center2 = [0,-5,0] deltaAngle2 = 360/iAnz2 vec2 = [1, 1, 1] for i in range(iAnz2): angX2 = deltaAngle2*i vecX2 = rs.VectorRotate( vec2, angX2 , [random.uniform(-1,1),random.uniform(-1,1),random.uniform(-1,1)]) vecX2 = rs.VectorScale( vecX2, random.uniform( 3.5,iRad2) ) vecX2 = rs.VectorAdd( vecX2, center2) rs.AddPoint( vecX2 ) Sph2=rs.AddPoint(vecX2) rs.ObjectColor(Sph2, [random.uniform(1,200), random.uniform(1,200),random.uniform(1,200)]) #3 if 1: CubeP = [0, 0, 0] CubeS = 10 points = 5000 CubePs = [] for i in range(points): randX = random.uniform(CubeP[0], CubeP[0] + CubeS) randY = random.uniform(CubeP[1], CubeP[1] + CubeS) randZ = random.uniform(CubeP[2], CubeP[2] + CubeS) point = rs.AddPoint([randX, randY, randZ]) CubePs.append(point) #4 if 1: CubeP2 = [10, 0, 0] CubeS2 = 10 points2 = 5000 CubePs2 = [] for i in range(points2): randX2 = random.uniform(CubeP2[0], CubeP2[0] + CubeS2) randY2 = random.uniform(CubeP2[1], CubeP2[1] + CubeS2) randZ2 = random.uniform(CubeP2[2], CubeP2[2] + CubeS2) point2 = rs.AddPoint([randX2, randY2, randZ2]) CubePs2.append(point2) #5 if 1: CubeP3 = [0, 0, 7] CubeS3 = 10 points3 = 5000 CubePs3 = [] for i in range(points3): randX3 = random.uniform(CubeP3[0], CubeP3[0] + CubeS3) randY3 = random.uniform(CubeP3[1], CubeP3[1] + CubeS3) randZ3 = random.uniform(CubeP3[2], CubeP3[2] + CubeS3) point3 = rs.AddPoint([randX3, randY3, randZ3]) CubePs3.append(point3) #6 if 1: iAnz3 = 5000 iRad3 = 3 center3 = [16,16,0] deltaAngle3 = 360/iAnz3 vec3 = [1, 1, 1] for i in range(iAnz3): angX3 = deltaAngle3*i vecX3 = rs.VectorRotate( vec3, angX3 , [random.uniform(-1,1),random.uniform(-1,1),random.uniform(-1,1)]) vecX3 = rs.VectorScale( vecX3, random.uniform( 3,iRad3) ) vecX3 = rs.VectorAdd( vecX3, center3) rs.AddPoint( vecX3 ) Sph3=rs.AddPoint(vecX3) rs.ObjectColor(Sph3, [random.uniform(1,200), random.uniform(1,200),random.uniform(1,200)]) #7 if 1: iAnz4 = 5000 iRad4 = 3.5 center4 = [0,16,0] deltaAngle4 = 360/iAnz4 vec4 = [1, 1, 1] for i in range(iAnz4): angX4 = deltaAngle4*i vecX4 = rs.VectorRotate( vec4, angX4 , [random.uniform(-1,1),random.uniform(-1,1),random.uniform(-1,1)]) vecX4 = rs.VectorScale( vecX4, random.uniform( 3.5,iRad4) ) vecX4 = rs.VectorAdd( vecX4, center4) rs.AddPoint( vecX4) Sph4=rs.AddPoint(vecX4) rs.ObjectColor(Sph4, [random.uniform(1,200), random.uniform(1,200),random.uniform(1,200)]) #details #1 if 1: CubeP4 = [18, 2, 10] CubeS4 = 1 points4 = 2000 CubePs4 = [] for i in range(points4): randX4 = random.uniform(CubeP4[0], CubeP4[0] + CubeS4) randY4 = random.uniform(CubeP4[1], CubeP4[1] + CubeS4) randZ4 = random.uniform(CubeP4[2], CubeP4[2] + CubeS4) point4 = rs.AddPoint([randX4, randY4, randZ4]) CubePs4.append(point4) #2 if 1: CubeP5 = [-1, 5, 2] CubeS5 = 1 points5 = 2000 CubePs5 = [] for i in range(points5): randX5 = random.uniform(CubeP5[0], CubeP5[0] + CubeS5) randY5 = random.uniform(CubeP5[1], CubeP5[1] + CubeS5) randZ5 = random.uniform(CubeP5[2], CubeP5[2] + CubeS5) point5 = rs.AddPoint([randX5, randY5, randZ5]) CubePs5.append(point5) #3 if 1: CubeP6 = [2, 4, 17] CubeS6 = 1 points6= 2000 CubePs6 = [] for i in range(points6): randX6 = random.uniform(CubeP6[0], CubeP6[0] + CubeS6) randY6 = random.uniform(CubeP6[1], CubeP6[1] + CubeS6) randZ6 = random.uniform(CubeP6[2], CubeP6[2] + CubeS6) point6 = rs.AddPoint([randX6, randY6, randZ6]) CubePs6.append(point6) ### auspuff an und ausschalten if 1: CubeP7 = [-2, 3, 0.5] CubeS7 = 1 points7 = 100 CubePs7 = [] for i in range(points7): randX7 = random.uniform(CubeP7[0], CubeP7[0] + -20) randY7 = random.uniform(CubeP7[1], CubeP7[1] + 5) randZ7 = random.uniform(CubeP7[2], CubeP7[2] + 5) point7 = rs.AddPoint([randX7, randY7, randZ7]) CubePs7.append(points7)