Example #1
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)
        ])
    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)])
 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)
Example #5
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)])
Example #6
0
 def test_export_json(self):
     #path = os.tmpfile()
     path = os.tmpnam() + ".json"
     self.glider.export_3d(path)
     import json
     file = open(path, "r")
     data = json.load(file)
     print(data["panels"])
     print(data["nodes"])
     G.Graphics(
         [
             G.Polygon(panel["node_no"])
             for panel in data["panels"] if not panel["is_wake"]
         ],
         #G.Graphics([G.Polygon(data["panels"][0]["node_no"])],
         data["nodes"])
 def test_panel_3d(self):
     l1, r1, l2, r2 = sorted([random.random() for __ in range(4)])
     panel = Panel(l1, l2, r1, r2, self.cell_no)
     ribs = panel.get_3d(glider=self.glider, numribs=10)
     Graph.Graphics(map(Graph.Line, ribs))
Example #8
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)])
Example #9
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)])
Example #10
0
 def show(self):
     baseline = Graph.Line([self.p1, self.p2])
     Graph.Graphics([baseline] +
                    [Graph.Line(l) for l in self.text.get_vectors()])
 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)])
Example #12
0
    def test_all_2(self):
        a = self.get_all()
        self.setUp()
        b = self.get_all()

        Graph.Graphics(a + b)
 def test_panel_3d(self):
     Graph.Graphics(self.get_panels())