Skip to content

Commit 57b9190

Browse files
committed
test AABB
1 parent 0566995 commit 57b9190

File tree

1 file changed

+60
-59
lines changed

1 file changed

+60
-59
lines changed

tests/test_all.py

Lines changed: 60 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -14,64 +14,64 @@
1414
def test_nothing():
1515
pass
1616

17-
#
18-
###def rand_sparse(n,density):
19-
### n_features = n
20-
### n_samples = n
21-
### rng1 = np.random.RandomState(42)
22-
### rng2 = np.random.RandomState(43)
23-
###
24-
### nnz = int(n_samples*n_features*density)
25-
###
26-
### row = rng1.randint(n_samples, size=nnz)
27-
### cols = rng2.randint(n_features, size=nnz)
28-
### data = rng1.rand(nnz)
29-
###
30-
### S = scipy.sparse.coo_matrix((data, (row, cols)), shape=(n_samples, n_features))
31-
### return S.tocsc()
32-
###
33-
###def time_noop():
34-
### def helper(N,I,SN,SI):
35-
### igl.noop(SN=SN)
36-
### # start timer
37-
### runs = 100
38-
### start = time.time()
39-
### for i in range(runs):
40-
### igl.noop(SN=SN)
41-
### # end timer
42-
### end = time.time()
43-
### return (end - start)/runs
44-
### n = 10000
45-
### m = 10
46-
### N64_f = np.asfortranarray(np.random.randn(n,m).astype(np.float64))
47-
### I64_f = np.asfortranarray(np.random.randn(n,m).astype(np.int64))
48-
### # random sparse matrix
49-
### SN64 = rand_sparse(n,1.0/(n))
50-
### # print number of nonzeros
51-
### SI64 = (rand_sparse(n,1.0/(n))*1000).astype(np.int64)
52-
### print(f"noop<{n},{m}>: {helper(N64_f,I64_f,SN64,SI64)} secs")
53-
###
54-
###time_noop()
17+
18+
##def rand_sparse(n,density):
19+
## n_features = n
20+
## n_samples = n
21+
## rng1 = np.random.RandomState(42)
22+
## rng2 = np.random.RandomState(43)
5523
##
56-
### print(igl.matlab_format(V,"V"))
57-
### print(igl.matlab_format_index(F,"F"))
58-
### print(igl.matlab_format(dV,"dV"))
59-
### print(igl.matlab_format_index(dF,"dF"))
60-
#
61-
#
62-
## seed numpy's random number generator
24+
## nnz = int(n_samples*n_features*density)
6325
##
64-
#def triangulated_square():
65-
# V = np.array([[0,0,0],[1,0,0],[1,1,0],[0,1,0]],dtype=np.float64)
66-
# F = np.array([[0,1,2],[0,2,3]],dtype=np.int64)
67-
# return V,F
26+
## row = rng1.randint(n_samples, size=nnz)
27+
## cols = rng2.randint(n_features, size=nnz)
28+
## data = rng1.rand(nnz)
29+
##
30+
## S = scipy.sparse.coo_matrix((data, (row, cols)), shape=(n_samples, n_features))
31+
## return S.tocsc()
32+
##
33+
##def time_noop():
34+
## def helper(N,I,SN,SI):
35+
## igl.noop(SN=SN)
36+
## # start timer
37+
## runs = 100
38+
## start = time.time()
39+
## for i in range(runs):
40+
## igl.noop(SN=SN)
41+
## # end timer
42+
## end = time.time()
43+
## return (end - start)/runs
44+
## n = 10000
45+
## m = 10
46+
## N64_f = np.asfortranarray(np.random.randn(n,m).astype(np.float64))
47+
## I64_f = np.asfortranarray(np.random.randn(n,m).astype(np.int64))
48+
## # random sparse matrix
49+
## SN64 = rand_sparse(n,1.0/(n))
50+
## # print number of nonzeros
51+
## SI64 = (rand_sparse(n,1.0/(n))*1000).astype(np.int64)
52+
## print(f"noop<{n},{m}>: {helper(N64_f,I64_f,SN64,SI64)} secs")
53+
##
54+
##time_noop()
6855
#
69-
#def single_tet():
70-
# V = np.array([[0,0,0],[1,0,0],[0,1,0],[0,0,1]],dtype=np.float64)
71-
# F = np.array([[2,1,0],[1,3,0],[3,2,0],[2,3,1]],dtype=np.int64)
72-
# T = np.array([[0,1,2,3]],dtype=np.int64)
73-
# return V,F,T
56+
## print(igl.matlab_format(V,"V"))
57+
## print(igl.matlab_format_index(F,"F"))
58+
## print(igl.matlab_format(dV,"dV"))
59+
## print(igl.matlab_format_index(dF,"dF"))
60+
61+
62+
# seed numpy's random number generator
7463
#
64+
def triangulated_square():
65+
V = np.array([[0,0,0],[1,0,0],[1,1,0],[0,1,0]],dtype=np.float64)
66+
F = np.array([[0,1,2],[0,2,3]],dtype=np.int64)
67+
return V,F
68+
69+
def single_tet():
70+
V = np.array([[0,0,0],[1,0,0],[0,1,0],[0,0,1]],dtype=np.float64)
71+
F = np.array([[2,1,0],[1,3,0],[3,2,0],[2,3,1]],dtype=np.int64)
72+
T = np.array([[0,1,2,3]],dtype=np.int64)
73+
return V,F,T
74+
7575
#def test_edges():
7676
# F = np.array([[0,1,2],[0,2,3]],dtype=np.int64)
7777
# E,oE = igl.orient_halfedges(F)
@@ -168,11 +168,12 @@ def test_nothing():
168168
# V,T,F = igl.readMESH("out.mesh")
169169
# igl.writeMSH("out.msh",V,F,T)
170170
# V,F,T,_,_,_,_,_,_,_ = igl.readMSH("out.msh")
171-
#
172-
#def test_bvh():
173-
# V,F,T = single_tet()
174-
# tree = igl.AABB()
175-
# tree.init(V,T)
171+
172+
def test_bvh():
173+
V,F,T = single_tet()
174+
tree = igl.AABB()
175+
tree.init(V,T)
176+
176177
# P = np.array([[0.5,0.5,0.0],[0.5,0.5,0.5]],dtype=np.float64)
177178
# # first row of P
178179
# q = P[0,:]

0 commit comments

Comments
 (0)