#Thomas Poelzl-Hausuebung 3 import rhinoscriptsyntax as rs import random, time, sys rs.EnableRedraw(0) #1 if 1: iAnz = 5000 iRad = 2 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( 5,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 = 2 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( 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 = [5, 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 = [0, 0, 0] CubeS2 = 10 points2 = 5000 CubePs2 = [] 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]) CubePs2.append(point) #5 if 1: iAnz3 = 5000 iRad3 = 2 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( 5,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)]) #6 if 1: iAnz4 = 5000 iRad4 = 2 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( 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)])