예제 #1
0
 def test_make_island_from_a_cube_with_cuts(self):
     jMesh = mesh.make_cube_mesh()
     viewer = mesh.MeshDisplayer(jMesh)
     viewer.displayEdgesIdx()
     cuts = [8, 0, 4, 10, 3, 11, 5]
     jMesh.set_cuts(cuts)
     viewer.display_edges(cuts)
     viewer.displayFacesIdx()
     self.islandMaker = make.IslandMaker(None, jMesh, 0)
     meshLoc = make.MeshLoc(face=1, edge=4)
     start_frame = trans.Frame.create_frame_from_tuples(
         (10, 0, 0), (1, 0, 0), (0, 1, 0))
     start_frame.show()
     island, visited_faces = self.islandMaker.make_island(
         meshLoc, start_frame)
     island.draw_all()
     correct_points = [
         geom.Point3d(15, 0, 0),  #0    
         geom.Point3d(10, 0, 0),  #1
         geom.Point3d(15, 5, 0),  #2 
         geom.Point3d(10, 5, 0),  #3 
         geom.Point3d(15, 10, 0),  #4
         geom.Point3d(10, 10, 0),  #5
         geom.Point3d(15, 15, 0),  #6
         geom.Point3d(10, 15, 0),  #7
         geom.Point3d(20, 10, 0),  #8
         geom.Point3d(20, 15, 0),  #9
         geom.Point3d(15, 20, 0),  #10
         geom.Point3d(10, 20, 0),  #11
         geom.Point3d(5, 15, 0),  #12
         geom.Point3d(5, 10, 0)  #13 ]
     ]
     island.has_same_points(correct_points)
     self.assertSetEqual(set(visited_faces), set(range(6)))
예제 #2
0
    def _test_make_island_cone(self):
        meshFile = "/TestMeshes/cone"
        myMesh = mesh.Mesh(meshLoad.load_mesh(meshFile))
        displayer = mesh.MeshDisplayer(myMesh)
        displayer.display_all_elements()
        face = 0
        edge = myMesh.getFaceEdges(face)[0]
        island_idx = 0
        self.islandMaker = make.IslandMaker(None, myMesh, island_idx)

        meshLoc = make.MeshLoc(face, edge)
        start_frame = trans.Frame.create_frame_from_tuples(
            (20, 0, 0), (1, 0, 0), (0, 1, 0))
        start_frame.show()
        island, visited_faces = self.islandMaker.make_island(
            meshLoc, start_frame)
        island.draw_all()
예제 #3
0
 def test_unfolds_a_segment_of_cube(self):
     jMesh = mesh.make_cube_mesh()
     viewer = mesh.MeshDisplayer(jMesh)
     viewer.displayEdgesIdx()
     cuts = [3, 4, 10, 11, 6, 5]
     jMesh.set_cuts(cuts)
     viewer.display_edges(cuts)
     self.islandMaker = make.IslandMaker(None, jMesh, 0)
     meshLoc = make.MeshLoc(face=1, edge=4)
     island, visited_faces = self.islandMaker.make_island(meshLoc)
     island.draw_all()
     correct_points = [
         geom.Point3d(5, 0, 0),
         geom.Point3d(0, 0, 0),
         geom.Point3d(5, 5, 0),
         geom.Point3d(0, 5, 0),
         geom.Point3d(5, 10, 0),
         geom.Point3d(0, 10, 0)
     ]
     island.has_same_points(correct_points)
     self.assertEqual([1, 5], visited_faces)
예제 #4
0
 def __init__(self, myMesh):
     self.myMesh = myMesh
     self.dataMap = Map.Map(self.myMesh)
     self.net = nt.Net(self.myMesh)
     self.islandMaker = islandMaker.IslandMaker(self.dataMap, self.myMesh)
     self.processed_faces = set()
예제 #5
0
 def setUp(self):
     self.myMesh = mesh.make_upright_mesh()
     self.meshDisplayer = mesh.MeshDisplayer(self.myMesh)
     self.meshDisplayer.display_all_elements()
     self.island_idx = 0
     self.islandMaker = make.IslandMaker(None, self.myMesh, self.island_idx)