
###dm2
###2. hue
###lisafixl
###15.10.2024


import rhinoscriptsyntax as rs
import random

# Wuerfel
coords = []
for i in range(10000):
    x = random.uniform(0, 20) 
    y = random.uniform(0, 20) 
    z = random.uniform(40, 60)
    x = x - 5    
    y = y - 5
    z = z - 5
    coords.append([x, y, z])

# Punkte darstellen
points = rs.AddPoints(coords)

# Kugel
sphere_coords = []
radius = 10  

for i in range(10000):
    # Punkte innerhalb der Kugel
    while True:
        x = random.uniform(-radius, radius)
        y = random.uniform(-radius, radius)
        z = random.uniform(-radius, radius)
        if (x**2 + y**2 + z**2) <= radius**2:
            sphere_coords.append([x, y, z])
            break  

# Punkte darstellen
sphere_points = rs.AddPoints(sphere_coords)

# Punkte in blau - Kugel
for pnt in sphere_points:
    colo = [0, 0, random.randint(100, 255)]  
    rs.ObjectColor(pnt, colo)
    

# Linien 
for i in range(min(len(points), len(sphere_points))):
    start_point = points[i]
    end_point = sphere_points[i]
    rs.AddLine(start_point, end_point)


