aUCBLogo Demos and Tests / smith2
to smith1
pr "Smith1
; z1=0+0i ; z1= 3+5i
; pos1 = se -300 0 _setpos pos1
f=400
hT
;setPC rgb 1 0 0
;setPenSize 10
for [k2 -1 1 .5]
[ PD
for [k1 -100 100 .1]
[
; z2= k2*z1+(2+k1*3i)
z2= k2+(2+k1*3i)
w=(z2-1)/(z2+1)
; coords=fPut se real z1*f imag z1*f lPut se real w*f imag w*f []
_setPos Se f*real w f*imag w
; pr Se f*real w f*imag w ; pr coords
; hT Line coords 1
]
PU
]
;setPC rgb 0 1 0
for [k2 1 5 .2]
[ PD
for [k1 -100 100 .1]
[
; z2= k2*z1+(2+k1*3i)
z2= k2+(2+k1*3i)
w=(z2-1)/(z2+1)
; coords=fPut se real z1*f imag z1*f lPut se real w*f imag w*f []
_setPos Se f*real w f*imag w
; pr Se f*real w f*imag w ; pr coords
; hT Line coords 1
]
PU
]
;setPC rgb 0 0 1
for [k2 5 10 1]
[ PD
for [k1 -100 100 .1]
[
; z2= k2*z1+(2+k1*3i)
z2= k2+(2+k1*3i)
w=(z2-1)/(z2+1)
; coords=fPut se real z1*f imag z1*f lPut se real w*f imag w*f []
_setPos Se f*real w f*imag w
; pr Se f*real w f*imag w ; pr coords
; hT Line coords 1
]
PU
]
;setPC rgb 1 0 0
for [k2 10 20 2]
[ PD
for [k1 -100 100 .1]
[
; z2= k2*z1+(2+k1*3i)
z2= k2+(2+k1*3i)
w=(z2-1)/(z2+1)
; coords=fPut se real z1*f imag z1*f lPut se real w*f imag w*f []
_setPos Se f*real w f*imag w
; pr Se f*real w f*imag w ; pr coords
; hT Line coords 1
]
PU
]
sT
end
to smith2
home
;setPenSize 4
pr "Smith2
; z1= 3+5i
; pos1 = se -300 0 _setpos pos1
rf=60 ; radius factor
phi0=Pi/2 ; start angle
hT
c3i=3i
for [k2 -.9 .9 .05]
[ PD
for [k1 0 20 .1]
[
z= (1+k2*c3i)+k1
y=1/z
w=(y+1)/(y-1)
; coords=fPut se real z1*f imag z1*f lPut se real w*f imag w*f []
; x1=r*RadCos phi1 y1=r*RadSin phi1
x3=rf*real w x4=rf*imag w
; r=rPol x3 x4 phi=pPolRad x3 x4
; phi=phi0+phi
; x3=xRec r phi x4=yRec r phi
_setPos Se (x3+460) x4
; pr Se f*real w f*imag w ;pr coords
; hT Line coords 1
; pr Se x3 x4
]
PU
]
sT
end
to xRec r phi
op r*radCos phi
end
to yRec r phi
op r*radSin phi
end
to rPol x y
op Sqrt (x*x+y*y)
end
to pPolDec x y
if and x>0 y>0 [op ArcTan y/x]
if x<0 [op 180+ArcTan y/x]
if and x>0 y<0 [op 360+ArcTan y/x]
end
to pPolRad x y
if and x>0 y>0 [op radArcTan y/x]
if x<0 [op Pi+radArcTan y/x]
if and x>0 y<0 [op 2*Pi+radArcTan y/x]
end
to rad alpha
op Pi*alpha/180
end
to deg phi
op 180*phi/Pi
end
to dd2 k2
; [-1 1] [1 5] [5 10] [10 20]
if k2<1 [op .1]
if and k2>=1 k2<5 [op .2]
if and k2>=5 k2<10 [op 1]
if and k2>=10 k2<20 [op 2]
end
;Make "Startup [smith]