forked from rlucas92/AnimatSimulation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testnorm.py
45 lines (38 loc) · 849 Bytes
/
testnorm.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import numpy as np
import scipy.spatial
from scipy import *
import time
global t1
global t2
def tic():
global t1
t1 = time.clock()
def toc():
global t2
global t1
t2 = time.clock()
print(t2-t1)
t1 = t2
a = np.array([1,])
print a
a = np.insert(a, 0, 100)
print a
points = np.array([[2,3],[5,0],[1,2]])
print(points)
smells = np.array([[5, 2], [6, 4],[7, 3], [8, 5]])
smellstrength = np.array([[0, 1, 2, 3]])
#smellstrength=1
print(smells)
#smell = np.array([[5],[2]])
#print(points-smells)
#tic()
#dists = np.linalg.norm(points-smells,axis=1)
#toc()
#print(dists)
print(np.sum(scipy.spatial.distance.cdist( points, smells )*smellstrength, axis=1))
points = np.array([[1,0],[2,0]])
print(points)
dir = np.pi/2
rotMat = np.array([[cos(dir), -sin(dir)], [sin(dir), cos(dir)]])
print(rotMat)
print(np.dot(points,rotMat))