def __init__(self,numIslands=5): self.islands = [] for i in range(numIslands): new_island = island.Island() island.make_five_by_five_square_island(new_island) new_island.draw_edges() self.islands.append(new_island)
def test_transform(self): island.make_five_by_five_square_island(self.island) self.island.draw_edges() self.island.clear() vec = geom.Vector3d(20.0,0.0,0.0) self.island.translate(vec) self.island.draw_edges()
def test_get_frame_reverse_edge(self): island.make_five_by_five_square_island(self.island) frame = self.island.get_frame_reverse_edge(edge=1, face=0) frame.show() correct_frame = trans.Frame.create_frame_from_tuples( (5, 5, 0), (0, -1, 0), (1, 0, 0)) self.assertTrue(correct_frame.is_equal(frame))
def __init__(self, numIslands=5): self.islands = [] for i in range(numIslands): new_island = island.Island() island.make_five_by_five_square_island(new_island) new_island.draw_edges() self.islands.append(new_island)
def test_transform(self): island.make_five_by_five_square_island(self.island) self.island.draw_edges() self.island.clear() vec = geom.Vector3d(20.0, 0.0, 0.0) self.island.translate(vec) self.island.draw_edges()
def make_overlapping_islands(self): islandA = self.island islandB = island.Island() island.make_five_by_five_square_island(islandA) island.make_five_by_five_square_island(islandB) islandB.translate(geom.Vector3d(2,0,0)) islandA.draw_edges() islandB.draw_edges() return islandA,islandB
def make_overlapping_islands(self): islandA = self.island islandB = island.Island() island.make_five_by_five_square_island(islandA) island.make_five_by_five_square_island(islandB) islandB.translate(geom.Vector3d(2, 0, 0)) islandA.draw_edges() islandB.draw_edges() return islandA, islandB
def test_get_boundary_polyline(self): #deprivated, since now in general not drwaing lines #However, if needed can easily specifically draw cut lines island.make_five_by_five_square_island(self.island) self.island.clear() self.island.draw_edges() boundary = self.island.get_boundary_polyline() self.assertTrue(rs.IsPolyCurve(boundary)) self.assertTrue(rs.IsCurveClosed(boundary)) self.assertTrue(rs.IsCurvePlanar(boundary)) self.island.clear()
def test_get_boundary_polyline(self): #deprivated, since now in general not drwaing lines #However, if needed can easily specifically draw cut lines island.make_five_by_five_square_island(self.island) self.island.clear() self.island.draw_edges() boundary = self.island.get_boundary_polyline() self.assertTrue(rs.IsPolyCurve(boundary)) self.assertTrue(rs.IsCurveClosed(boundary)) self.assertTrue(rs.IsCurvePlanar(boundary)) self.island.clear()
def _test_add_face_from_edge_and_new_verts(self): island.make_five_by_five_square_island() new_vert = self.island.add_vert_from_points(10.0,0.0,0.0) edge = self.island.flatEdges[1] self.island.add_face_from_edge_and_new_verts(edge,[new_vert]) new_verts = [] new_verts.append(self.island.add_vert_from_points(5.0,10.0,0.0)) new_verts.append(self.island.add_vert_from_points(4.0,7.0,0.0)) new_verts.append(self.island.add_vert_from_points(0.0,10.0,0.0)) edge = self.island.flatEdges[2] self.island.add_face_from_edge_and_new_verts(edge,new_verts) self.island.draw_edges() self.island.draw_verts()
def _test_add_face_from_edge_and_new_verts(self): island.make_five_by_five_square_island() new_vert = self.island.add_vert_from_points(10.0, 0.0, 0.0) edge = self.island.flatEdges[1] self.island.add_face_from_edge_and_new_verts(edge, [new_vert]) new_verts = [] new_verts.append(self.island.add_vert_from_points(5.0, 10.0, 0.0)) new_verts.append(self.island.add_vert_from_points(4.0, 7.0, 0.0)) new_verts.append(self.island.add_vert_from_points(0.0, 10.0, 0.0)) edge = self.island.flatEdges[2] self.island.add_face_from_edge_and_new_verts(edge, new_verts) self.island.draw_edges() self.island.draw_verts()
def test_get_frame_reverse_edge(self): island.make_five_by_five_square_island(self.island) frame = self.island.get_frame_reverse_edge(edge=1,face=0) frame.show() correct_frame = trans.Frame.create_frame_from_tuples((5,5,0),(0,-1,0),(1,0,0)) self.assertTrue(correct_frame.is_equal(frame))
def test_add_first_face_from_verts(self): island.make_five_by_five_square_island(self.island) face = 0 self.assertEqual(self.island.flatFaces[face].edges,[0,1,2,3]) self.island.draw_edges() self.island.draw_faces()
def test_get_bounding_rectangle(self): island.make_five_by_five_square_island(self.island) self.island.draw_edges() rect = self.island.get_bounding_rectangle() self.island.clear()
def test_add_first_face_from_verts(self): island.make_five_by_five_square_island(self.island) face = 0 self.assertEqual(self.island.flatFaces[face].edges, [0, 1, 2, 3]) self.island.draw_edges() self.island.draw_faces()
def test_get_bounding_rectangle(self): island.make_five_by_five_square_island(self.island) self.island.draw_edges() rect = self.island.get_bounding_rectangle() self.island.clear()