anp-scp commited on
Commit
b721bd3
1 Parent(s): b3bb8b2

moved all functions to utils

Browse files
Files changed (2) hide show
  1. __init__.py +0 -0
  2. utils.py +31 -0
__init__.py ADDED
File without changes
utils.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+
4
+ def getSquareY(x):
5
+ if x==-1 or x == 1:
6
+ return 0
7
+ else:
8
+ return 1
9
+
10
+ getSquareYVectorised = np.vectorize(getSquareY)
11
+
12
+ def getCircle(x):
13
+ return np.sqrt(1-np.square(x))
14
+
15
+ def transform(x,y,t):
16
+ points = np.array([x,y])
17
+ result = t @ points
18
+ return result[0,:], result[1,:]
19
+
20
+ def plotGridLines(xlim,ylim,t):
21
+ for i in range(xlim[0]-20,xlim[1]+21):
22
+ x = [i,i]
23
+ y = [ylim[0]-20,ylim[1]+20]
24
+ x,y = transform(x,y,t)
25
+ plt.plot(x,y, color='#DAD5D4',linestyle='dashed',linewidth=0.5)
26
+ for i in range(ylim[0]-20,ylim[1]+21):
27
+ y = [i,i]
28
+ x = [xlim[0]-20,xlim[1]+20]
29
+ x,y = transform(x,y,t)
30
+ plt.plot(x,y, color='#DAD5D4',linestyle='dashed',linewidth=0.5)
31
+