import rhinoscriptsyntax as rs
import math

#delete everything and start from scratch
allobjs = rs.AllObjects()
rs.DeleteObjects (allobjs)

import sys                                  # load System Library

# Get all the system paths
print(sys.path)

roopNum = 20
originPt = [0.0, 0.0, 0.0]
originPt_x = 0
originPt_y = 0

for i in range(roopNum):

    if(i == 0):
        fn0 = 0
        fn1 = 0  #the initial term of Fibonacci number
        fn  = 1  #the first term of Fibonacci number
    else:
        fn = fn1 + fn0 #Fibonacci progression

    rs.AddPoint(originPt)
    # move_pt = [(0,0),(0,0),(1,0),(1,1),(-1,1),(-1,-2),(4,-2),(4,6),(-9,6),(-9,-15)]

    # get the quater
    origin_qt = round(math.sin(math.radians(90*i+45)))
    # reverse for first two quaters
    origin_qt *= -1

    # mit move


import rhinoscriptsyntax as rs
import math

#delete everything and start from scratch
allobjs = rs.AllObjects()
rs.DeleteObjects (allobjs)

import sys                                  # load System Library

# Get all the system paths
print(sys.path)

# sys.path.append( "lib/" )                ## set relative path,
sys.path.append( "P:/dm2/lib/")            ## set absolute path to our P:// Drive

# Import our own library file (uncomment to use it)
# import my_dm2_lib as dm2lib

# reload the library in case wie change something in the meantime (uncomment to use it only while changing code)
# reload(dm2lib)

"""
# ------------------------ Pyramiden --------------------------

n = 10

for x in range(n+1):
    for y in range(n+1):
        if(y < x and y < -x + n):
        # if(y > x and y > -x + n):
        # if(y < x):
        # if(y > x):
            rs.AddCircle([x, y, 0.0], 0.5)

# ------------ 3D version Pyramiden ------------------------------

for x in range(n+1):
    for y in range(n+1):
        for z in range(n+1):
            if(z < x and z < -x + n and z < y and z < -y + n):
                # if(y > x and y > -x + n):
                # if(y < x):
                # if(y > x):
                rs.AddCircle([x, y, z], 0.5)
"""
# ---------------- Archimedische Spirale --------------------------

n = 20
width_var = 3
curve_pt_var = []

for n in range(n+1):
    t = (math.pi/4) * n
    x = (1 + width_var * t) * math.cos(t)
    y = (1 + width_var * t) * math.sin(t)
    point = (x,y)
    rs.AddPoint(point)
    curve_pt_var.append(point)

rs.AddCurve(curve_pt_var, 2)