Пример #1
0
 def test_diagonal_rib_3d(self):
     cell = self.glider.cells[self.cell_no]
     diag = DiagonalRib((0.1, -1), (0.3, -1), (0.1, 0.8), (0.5, 0.8), self.cell_no)
     l1, l2 = diag.get_3d(self.glider)
     l1 = l1.tolist()
     Graph.Graphics([Graph.Line(cell.rib1.profile_3d.data),
                     Graph.Line(cell.rib2.profile_3d.data),
                     Graph.Polygon(l1 + l2[::-1])])
    def test_all(self):
        att = (0.1, 0.3, 0.55, 0.8)
        panels = self.get_panels()
        diagonals = [self.get_diagonal(x) for x in att]
        straps = [self.get_strap(x) for x in att]

        Graph.Graphics([
            Graph.Line(self.cell.rib1.profile_3d.data),
            Graph.Line(self.cell.rib2.profile_3d.data)
        ] + panels + diagonals + straps)
Пример #3
0
 def xtest_mirror(self):
     cell1 = self.cell2
     cell2 = self.cell2.copy()
     cell2.mirror()
     Graph.Graphics([Graph.Line(cell1.rib1.profile_3d.data),
                     Graph.Line(cell2.rib1.profile_3d.data),
                     Graph.Red,
                     Graph.Line(cell1.prof2.data),
                     Graph.Line(cell2.prof2.data),
                     Graph.Green] +
                    [Graph.Line([p, p+normvector]) for p, normvector in zip(cell2.prof2.data, cell2.basic_cell.normvectors)])
Пример #4
0
    def test_gibus_arcs(self):
        rib_no = random.randint(0, len(self.glider.ribs)-1)
        gibus_arc = GibusArcs(rib_no=rib_no, position=.15, size=0.02)
        thalist = gibus_arc.get_3d(self.glider, num_points=20)

        Graph.Graphics([Graph.Line(self.glider.ribs[rib_no].profile_3d.data),
                        Graph.Polygon(thalist)])
Пример #5
0
    def runcase(self, path):
        key_dict = import_lines(path)
        # print(key_dict["LINES"][2])
        thalines = LineSet(key_dict["LINES"][2], np.array([100, 0, 1]))
        # for line in thalines.lines:
        #     line.lineset = thalines

        for _ in range(3):
            thalines.recalc(True)
        objects = map(lambda line: graph.Line(line.get_line_points(100)),
                      thalines.lines)
        graph.Graphics3D(objects)
Пример #6
0
    def test_flat(self):
        prof = self.rib.profile_2d.copy()
        prof = PolyLine2D(prof.data) * [self.rib.chord, self.rib.chord]

        print(self.rib.profile_2d, prof)
        #prof.scale(self.rib.chord)
        gib_pos = [n.rib_pos for n in self.attachment_points]
        gib_pos.sort()
        hole_pos = [(x1 + x2) / 2 for x1, x2 in zip(gib_pos[:-1], gib_pos[1:])]

        rigid = RigidFoil(-.15, .12)
        r_flat = rigid.get_flattened(self.rib)

        print(self.rib.rotation_matrix,
              norm(self.rib.rotation_matrix.dot([2, 0, 0])))
        Graph.Graphics([
            Graph.Line(prof),
            Graph.Line(self.rib.profile_2d.data * self.rib.chord),
            Graph.Line(r_flat)
        ])

        Graph.Graphics([
            Graph.Line([self.rib.align(p, scale=False) for p in prof.data]),
            Graph.Line([self.rib.align(p, scale=False) for p in r_flat]),
            Graph.Line(self.rib.profile_3d.data)
        ])
Пример #7
0
    def get_all(self):
        gib_pos = [n.rib_pos for n in self.attachment_points]
        gib_pos.sort()
        hole_pos = [(x1 + x2) / 2 for x1, x2 in zip(gib_pos[:-1], gib_pos[1:])]

        gibs = [self.get_gibus_arcs(y) for y in gib_pos]
        holes = [self.get_hole(x, 0.4) for x in hole_pos]
        rigid = self.get_rigid(-.15, .13)

        p = self.rib.profile_2d
        print(max([norm(p[0] - p2) for p2 in p]), self.rib.chord)

        return [Graph.Line(self.rib.profile_3d.data)] + gibs + holes + [rigid]
Пример #8
0
 def test_diagonal_rib_2d(self):
     diag = DiagonalRib((0.1, -1), (0.3, -1), (0.1, 0.8), (0.5, 0.8), self.cell_no)
     l1, l2 = diag.get_flattened(self.glider, ribs_flattened=None)
     Graph.Graphics2D([Graph.Line(l1.data.tolist()+l2.data.tolist()[::-1])])
Пример #9
0
 def test_show_cell(self, num=10):
     #print(self.rib1.profile_2d.x_values)
     ribs = [self.cell1.midrib(x * 1. / num) for x in range(num)]
     ribs += [self.cell2.midrib(x * 1. / num) for x in range(num)]
     Graph.Graphics([Graph.Line(x.data) for x in ribs] +
                    [Graph.Line(self.rib1.profile_3d.data)])
Пример #10
0
 def test_show_cell(self, num=20):
     ribs = [self.cell1.midrib(x*1./num, arc_argument=False) for x in range(num)]
     ribs += [self.cell2.midrib(x*1./num) for x in range(num)]
     Graph.Graphics([Graph.Line(x.data) for x in ribs]+[Graph.Line(self.rib3.profile_3d.data)])
Пример #11
0
 def show(self):
     baseline = Graph.Line([self.p1, self.p2])
     Graph.Graphics([baseline] +
                    [Graph.Line(l) for l in self.text.get_vectors()])
Пример #12
0
 def test_hole(self):
     rib_no = random.randint(0, len(self.glider.ribs)-1)
     hole = RibHole(rib_no, 0.2)
     thalist = hole.get_3d(self.glider)
     Graph.Graphics([Graph.Line(self.glider.ribs[rib_no].profile_3d.data),
                     Graph.Polygon(thalist)])
Пример #13
0
 def get_rigid(self, start, stop):
     rigid = RigidFoil(start, stop)
     #return Graph.Line([self.rib.align(p, scale=False) for p in rigid.get_flattened(self.rib)])
     return Graph.Line(rigid.get_3d(self.rib))