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