@@ -448,109 +448,109 @@ def test_bijective():
448448 U = igl .bijective_composite_harmonic_mapping (V ,F ,b ,bc )
449449
450450
451- # def test_copyleft():
452- # V = np.array([[0,0,-1],[2,0,-1],[0,2,-1],[1,1,1]],dtype=np.float64)
453- # T = np.array([[0,1,2,3]],dtype=np.int64)
454- # F,_,_ = igl.boundary_facets(T)
455- # V,F = igl.loop(V,F)
456- #
457- # dV,dF,J = igl.copyleft.progressive_hulls(V,F)
458- #
459- #
460- # def test_cgal():
461- # # tetrahedron
462- # VA = np.array([[0,0,-1],[2,0,-1],[0,2,-1],[1,1,1]],dtype=np.float64)
463- # T = np.array([[0,1,2,3]],dtype=np.int64)
464- # FA,_,_ = igl.boundary_facets(T)
465- # # flip z
466- # VB = np.array([[0,0,1],[2,0,1],[0,2,1],[1,1,-1]],dtype=np.float64)
467- # FB = FA[:,::-1]
468- # IF,_,_,_,_ = igl.copyleft.cgal.intersect_other(VA,FA,VB,FB)
469- # IF,_,_,_,_ = igl.copyleft.cgal.intersect_other(VA,FA,VB,FB,detect_only=True,first_only=True)
470- # VC,FC,J = igl.copyleft.cgal.mesh_boolean(VA,FA,VB,FB,"union")
471- # H = igl.copyleft.cgal.convex_hull(VC)
472- # # concatenate A and B meshes
473- # VC = np.vstack((VA,VB))
474- # FC = np.vstack((FA,FB+VA.shape[0]))
475- # VV,FF,IF,J,IM = igl.copyleft.cgal.remesh_self_intersections(VC,FC)
476- # _,_,IF,_,_ = igl.copyleft.cgal.remesh_self_intersections(VC,FC,detect_only=True,first_only=True)
477- #
478- # p = np.array([0,0,0],dtype=np.float64)
479- # n = np.array([1,1,1],dtype=np.float64)
480- # VV,FF,J = igl.copyleft.cgal.intersect_with_half_space(VC,FC,p,n)
481- # equ = np.hstack((n,-n.dot(p)))
482- # VV,FF,J = igl.copyleft.cgal.intersect_with_half_space(VC,FC,equ)
483- #
484- # P = np.array([[0.5,0.5,0.0],[0.5,0.5,0.5]],dtype=np.float64)
485- # W = igl.copyleft.cgal.fast_winding_number(VA,FA,P)
486- # W = igl.copyleft.cgal.fast_winding_number(VA,FA,P,expansion_order=2,beta=2.0)
487- #
488- # VC,FC,D,J = igl.copyleft.cgal.trim_with_solid(VA,FA,VB,FB)
489- #
490- # _,I,X = igl.random_points_on_mesh(1000,VC,FC)
491- # N = igl.per_face_normals(VC,FC)
492- # N = N[I,:]
493- # point_indices, CH,CN,W = igl.octree(X)
494- # I = igl.knn(X,X,20,point_indices,CH,CN,W)
495- # A,T = igl.copyleft.cgal.point_areas(X,I,N)
496- #
497- # def test_embree():
498- # # octahedron
499- # V = np.array([[1,0,0],[0,1,0],[0,0,1],[-1,0,0],[0,-1,0],[0,0,-1]],dtype=np.float64)
500- # F = np.array([[0,1,2], [0,2,4], [0,4,5], [0,5,1], [1,3,2], [1,5,3], [2,3,4], [3,5,4]],dtype=np.int64)
501- # N = igl.per_vertex_normals(V,F)
502- # ei = igl.embree.EmbreeIntersector();
503- # ei.init(V,F)
504- # S = igl.embree.ambient_occlusion(V,F,V,N,100)
505- # S = igl.embree.ambient_occlusion(ei,V,N,100)
506- # N = -N
507- # S = igl.embree.shape_diameter_function(V,F,V,N,100)
508- # S = igl.embree.shape_diameter_function(ei,V,N,100)
509- # origin = np.array([2,2,2],dtype=np.float64)
510- # direction = np.array([-2,-2,-2],dtype=np.float64)
511- # hit = ei.intersectRay_first(origin,direction)
512- # hits = ei.intersectRay(origin,direction)
513- # hits = ei.intersectRay(origin,direction,tnear=0,tfar=1)
514- # I,C = igl.embree.reorient_facets_raycast(V,F)
515- #
516- # def test_tetgen():
517- # # octahedron
518- # V = np.array([[1,0,0],[0,1,0],[0,0,1],[-1,0,0],[0,-1,0],[0,0,-1]],dtype=np.float64)
519- # F = np.array([[0,1,2], [0,2,4], [0,4,5], [0,5,1], [1,3,2], [1,5,3], [2,3,4], [3,5,4]],dtype=np.int64)
520- # V,T,F,_,_,_,_,_,_ = igl.copyleft.tetgen.tetrahedralize(V,F,flags="Q")
521- #
522- # def test_triangle():
523- # V = np.array([[0,0],[1,0],[1,1],[0,1]],dtype=np.float64)
524- # E = np.array([[0,1],[1,2],[2,3],[3,0]],dtype=np.int64)
525- # V,F,_,_,_ = igl.triangle.triangulate(V,E,flags="Qc")
526- # V,F,_,_,_ = igl.triangle.triangulate(V,E,flags="Q")
527- # V,F,_,_,_ = igl.triangle.triangulate(V,E,flags="Qqa0.1")
528- # V = np.array([[0,0,0],[1,0,0],[0,1,0],[0,0,1]],dtype=np.float64)
529- # F = np.array([[1,3,0],[3,2,0],[2,3,1]],dtype=np.int64)
530- # scaf_data = igl.triangle.SCAFData()
531- # b = np.array([0,1,2],dtype=np.int64)
532- # bc = np.array([[0,0],[1,0],[0,1]],dtype=np.float64)
533- # V_init = np.array([[0,0],[1,0],[0,1],[0.1,0.1]],dtype=np.float64)
534- # soft_p = 0;
535- # igl.triangle.scaf_precompute(V,F,V_init,igl.ARAP,b,bc,soft_p,scaf_data)
536- # L,rhs = igl.triangle.scaf_system(scaf_data)
537- # U = igl.triangle.scaf_solve(1,scaf_data)
538- #
539- # def test_misc():
540- # V,F = igl.icosahedron()
541- # BV,BF = igl.bounding_box(V,pad=1.0)
542- # R,C,B = igl.circumradius(V,F)
543- # R = igl.inradius(V,F)
544- # _,E,EMAP,_,_ = igl.unique_edge_map(F)
545- # L = igl.crouzeix_raviart_cotmatrix(V,F,E,EMAP)
546- # M = igl.crouzeix_raviart_massmatrix(V,F,E,EMAP)
547- # cuts = igl.cut_to_disk(F)
548- # V,F = igl.cylinder(10,10)
549- # VD,FD = igl.false_barycentric_subdivision(V,F)
550- # V,F,T = single_tet()
551- # theta, cos_theta = igl.dihedral_angles(V,T)
552- # L = igl.edge_lengths(V,T)
553- # A = igl.face_areas(V,T)
554- # theta, cos_theta = igl.dihedral_angles_intrinsic(L,A)
555- #
556- #
451+ def test_copyleft ():
452+ V = np .array ([[0 ,0 ,- 1 ],[2 ,0 ,- 1 ],[0 ,2 ,- 1 ],[1 ,1 ,1 ]],dtype = np .float64 )
453+ T = np .array ([[0 ,1 ,2 ,3 ]],dtype = np .int64 )
454+ F ,_ ,_ = igl .boundary_facets (T )
455+ V ,F = igl .loop (V ,F )
456+
457+ dV ,dF ,J = igl .copyleft .progressive_hulls (V ,F )
458+
459+
460+ def test_cgal ():
461+ # tetrahedron
462+ VA = np .array ([[0 ,0 ,- 1 ],[2 ,0 ,- 1 ],[0 ,2 ,- 1 ],[1 ,1 ,1 ]],dtype = np .float64 )
463+ T = np .array ([[0 ,1 ,2 ,3 ]],dtype = np .int64 )
464+ FA ,_ ,_ = igl .boundary_facets (T )
465+ # flip z
466+ VB = np .array ([[0 ,0 ,1 ],[2 ,0 ,1 ],[0 ,2 ,1 ],[1 ,1 ,- 1 ]],dtype = np .float64 )
467+ FB = FA [:,::- 1 ]
468+ IF ,_ ,_ ,_ ,_ = igl .copyleft .cgal .intersect_other (VA ,FA ,VB ,FB )
469+ IF ,_ ,_ ,_ ,_ = igl .copyleft .cgal .intersect_other (VA ,FA ,VB ,FB ,detect_only = True ,first_only = True )
470+ VC ,FC ,J = igl .copyleft .cgal .mesh_boolean (VA ,FA ,VB ,FB ,"union" )
471+ H = igl .copyleft .cgal .convex_hull (VC )
472+ # concatenate A and B meshes
473+ VC = np .vstack ((VA ,VB ))
474+ FC = np .vstack ((FA ,FB + VA .shape [0 ]))
475+ VV ,FF ,IF ,J ,IM = igl .copyleft .cgal .remesh_self_intersections (VC ,FC )
476+ _ ,_ ,IF ,_ ,_ = igl .copyleft .cgal .remesh_self_intersections (VC ,FC ,detect_only = True ,first_only = True )
477+
478+ p = np .array ([0 ,0 ,0 ],dtype = np .float64 )
479+ n = np .array ([1 ,1 ,1 ],dtype = np .float64 )
480+ VV ,FF ,J = igl .copyleft .cgal .intersect_with_half_space (VC ,FC ,p ,n )
481+ equ = np .hstack ((n ,- n .dot (p )))
482+ VV ,FF ,J = igl .copyleft .cgal .intersect_with_half_space (VC ,FC ,equ )
483+
484+ P = np .array ([[0.5 ,0.5 ,0.0 ],[0.5 ,0.5 ,0.5 ]],dtype = np .float64 )
485+ W = igl .copyleft .cgal .fast_winding_number (VA ,FA ,P )
486+ W = igl .copyleft .cgal .fast_winding_number (VA ,FA ,P ,expansion_order = 2 ,beta = 2.0 )
487+
488+ VC ,FC ,D ,J = igl .copyleft .cgal .trim_with_solid (VA ,FA ,VB ,FB )
489+
490+ _ ,I ,X = igl .random_points_on_mesh (1000 ,VC ,FC )
491+ N = igl .per_face_normals (VC ,FC )
492+ N = N [I ,:]
493+ point_indices , CH ,CN ,W = igl .octree (X )
494+ I = igl .knn (X ,X ,20 ,point_indices ,CH ,CN ,W )
495+ A ,T = igl .copyleft .cgal .point_areas (X ,I ,N )
496+
497+ def test_embree ():
498+ # octahedron
499+ V = np .array ([[1 ,0 ,0 ],[0 ,1 ,0 ],[0 ,0 ,1 ],[- 1 ,0 ,0 ],[0 ,- 1 ,0 ],[0 ,0 ,- 1 ]],dtype = np .float64 )
500+ F = np .array ([[0 ,1 ,2 ], [0 ,2 ,4 ], [0 ,4 ,5 ], [0 ,5 ,1 ], [1 ,3 ,2 ], [1 ,5 ,3 ], [2 ,3 ,4 ], [3 ,5 ,4 ]],dtype = np .int64 )
501+ N = igl .per_vertex_normals (V ,F )
502+ ei = igl .embree .EmbreeIntersector ();
503+ ei .init (V ,F )
504+ S = igl .embree .ambient_occlusion (V ,F ,V ,N ,100 )
505+ S = igl .embree .ambient_occlusion (ei ,V ,N ,100 )
506+ N = - N
507+ S = igl .embree .shape_diameter_function (V ,F ,V ,N ,100 )
508+ S = igl .embree .shape_diameter_function (ei ,V ,N ,100 )
509+ origin = np .array ([2 ,2 ,2 ],dtype = np .float64 )
510+ direction = np .array ([- 2 ,- 2 ,- 2 ],dtype = np .float64 )
511+ hit = ei .intersectRay_first (origin ,direction )
512+ hits = ei .intersectRay (origin ,direction )
513+ hits = ei .intersectRay (origin ,direction ,tnear = 0 ,tfar = 1 )
514+ I ,C = igl .embree .reorient_facets_raycast (V ,F )
515+
516+ def test_tetgen ():
517+ # octahedron
518+ V = np .array ([[1 ,0 ,0 ],[0 ,1 ,0 ],[0 ,0 ,1 ],[- 1 ,0 ,0 ],[0 ,- 1 ,0 ],[0 ,0 ,- 1 ]],dtype = np .float64 )
519+ F = np .array ([[0 ,1 ,2 ], [0 ,2 ,4 ], [0 ,4 ,5 ], [0 ,5 ,1 ], [1 ,3 ,2 ], [1 ,5 ,3 ], [2 ,3 ,4 ], [3 ,5 ,4 ]],dtype = np .int64 )
520+ V ,T ,F ,_ ,_ ,_ ,_ ,_ ,_ = igl .copyleft .tetgen .tetrahedralize (V ,F ,flags = "Q" )
521+
522+ def test_triangle ():
523+ V = np .array ([[0 ,0 ],[1 ,0 ],[1 ,1 ],[0 ,1 ]],dtype = np .float64 )
524+ E = np .array ([[0 ,1 ],[1 ,2 ],[2 ,3 ],[3 ,0 ]],dtype = np .int64 )
525+ V ,F ,_ ,_ ,_ = igl .triangle .triangulate (V ,E ,flags = "Qc" )
526+ V ,F ,_ ,_ ,_ = igl .triangle .triangulate (V ,E ,flags = "Q" )
527+ V ,F ,_ ,_ ,_ = igl .triangle .triangulate (V ,E ,flags = "Qqa0.1" )
528+ V = np .array ([[0 ,0 ,0 ],[1 ,0 ,0 ],[0 ,1 ,0 ],[0 ,0 ,1 ]],dtype = np .float64 )
529+ F = np .array ([[1 ,3 ,0 ],[3 ,2 ,0 ],[2 ,3 ,1 ]],dtype = np .int64 )
530+ scaf_data = igl .triangle .SCAFData ()
531+ b = np .array ([0 ,1 ,2 ],dtype = np .int64 )
532+ bc = np .array ([[0 ,0 ],[1 ,0 ],[0 ,1 ]],dtype = np .float64 )
533+ V_init = np .array ([[0 ,0 ],[1 ,0 ],[0 ,1 ],[0.1 ,0.1 ]],dtype = np .float64 )
534+ soft_p = 0 ;
535+ igl .triangle .scaf_precompute (V ,F ,V_init ,igl .ARAP ,b ,bc ,soft_p ,scaf_data )
536+ L ,rhs = igl .triangle .scaf_system (scaf_data )
537+ U = igl .triangle .scaf_solve (1 ,scaf_data )
538+
539+ def test_misc ():
540+ V ,F = igl .icosahedron ()
541+ BV ,BF = igl .bounding_box (V ,pad = 1.0 )
542+ R ,C ,B = igl .circumradius (V ,F )
543+ R = igl .inradius (V ,F )
544+ _ ,E ,EMAP ,_ ,_ = igl .unique_edge_map (F )
545+ L = igl .crouzeix_raviart_cotmatrix (V ,F ,E ,EMAP )
546+ M = igl .crouzeix_raviart_massmatrix (V ,F ,E ,EMAP )
547+ cuts = igl .cut_to_disk (F )
548+ V ,F = igl .cylinder (10 ,10 )
549+ VD ,FD = igl .false_barycentric_subdivision (V ,F )
550+ V ,F ,T = single_tet ()
551+ theta , cos_theta = igl .dihedral_angles (V ,T )
552+ L = igl .edge_lengths (V ,T )
553+ A = igl .face_areas (V ,T )
554+ theta , cos_theta = igl .dihedral_angles_intrinsic (L ,A )
555+
556+
0 commit comments