############################
### diag @ IAM @ DM2_w25 ###
### hu_03 setUp_ver00    ### see examples @ DM2_w23 hu_03 !
############################


##############################
import rhinoscriptsyntax as rs
import random, time, sys   ###
sys.path.append("P:/")     ###                  ### diag's path to DM_lib.py  .. please keep it !                                               
sys.path.append("P:/TUGonlineUsernam/dm2/")     ### *your* path to DM_lib.py                                            
sys.path.append("P:/WWW/limafi/dm2/") ### *your* path to DM_lib.py                                            
sys.path.append("/Users/macpro/Desktop/DM2")    ### *your* path to DM_lib.py      
import DM_lib as dm        ###                  ### "dm" is alias for DM_lib / for adressing definitions etc in "DM_lib.py"
############################## reload( dm )

rs.ShowGrid(show=0)
rs.ShowGridAxes(show=1)
rs.ViewDisplayMode(mode="Wireframe")
rs.EnableRedraw(0)

dm.PointRadius(displayModeX=0, rad=3, styl=3)                   ### displayModeX=0="Wireframe" / rad=size of points / styl=pointStyle (try 0..5) / default 3, 3
dm.printDisplay(state=1, scale=1, thickness=1, color="Display") ### state=0/1 = off/on / for showing printWidth etc

dm.eAA()

### BASIC SETUP / mandatory input:
if 0:
    allInOne = 1
    allCoords = dm.coordsCub (what="F")
    allCoords = dm.coordsCub (edge_len=10, anz_pts=10, what="F", angle=random.uniform(0,360), axe=dm.randVec(-1,1), pos=[0,0,10], allInOne=allInOne)
    
    coordsSph = allCoords[0]
    coordsCub = allCoords[1]



##### check setup - just visualization of coords
##### don't execute  @ final version of homework
if 1:
    rs.AddPoints( coordsSph )
    
    if allInOne:
        rs.AddPoints( coordsCub )
    else:
        for i,coords in enumerate(coordsCub): 
            pts = rs.AddPoints( coords )
##### end check setup

#######################################
################ HERE YOU GO AS YOU GO:

dm.setTime()

#rs.AddPoint([0,0,0])
#rs.AddPoint([1,0,0])
#rs.AddPoint([2,0,0])


###WUERFEL
anzahl = 10
coords = []
if 0: 
    for x in range(anzahl):  #punkte in x-richtung
        #rs.AddPoint([x,0,0]) #naechstes erledigt das auch
        for y in range(anzahl):
           #rs.AddPoint([x,y,0])
           for z in range(anzahl):
               #rs.AddPoint([x,y,z])
               coords.append([x,y,z]) #erledigt dasselbe wie oben nur schneller
rs.AddPoints(coords) # punkte darstellen

coords=[[x,y,z] for x in range(anzahl) for y in range(anzahl) for z in range(anzahl)] #anzahl und koordinate bilden 
axe = dm.randVec(-5,5)
for i, cor in enumerate(coords):
    cor [0] -=15   #wegzaehlen und rutscht nach links
    #cor = rs.VectorRotate(cor, 30, axe)
    cor = rs.VectorAdd (cor, dm.randVec(-1,1))
    coords[i] = cor






dm.getTime(1)
#################
#dm.eDup( 1 )
dm.zA( 0.5 ) ### zoom all minus 0.9


