コード例 #1
0
 def get_diagonal(self, x):
     diag = DiagonalRib((x - 0.01, -1), (x + 0.01, -1), (x - 0.06, 1),
                        (x + 0.06, 1))
     l1, l2 = diag.get_3d(self.cell)
     l1 = l1.data.tolist()
     l2 = l2.data.tolist()
     return Graph.Polygon(l1 + l2[::-1], colour=Graph.Red)
コード例 #2
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)])
コード例 #3
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])])
コード例 #4
0
    def get_panels(self):
        dc = ["left", "right", "type"]
        panel1 = Panel(dict(zip(dc, [-1, -1, 2])),
                       dict(zip(dc, [0.01, 0.01, 2])))
        panel2 = Panel(dict(zip(dc, [.06, .06, 2])), dict(zip(dc, [1, 1, 2])))
        ribs = panel1.get_3d(self.cell, numribs=10)

        mesh = (panel1.get_mesh(self.cell, numribs=9) +
                panel2.get_mesh(self.cell, numribs=9))
        tris = mesh.all_polygons
        return [Graph.Polygon(tri) for tri in tris]
コード例 #5
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"])
コード例 #6
0
r1 = r2.copy()
r1.mirror()
r3 = Rib(a, b2, [0.2, 0.3, -0.1], 0.8, 30 * math.pi / 180, 5 * math.pi / 180, 0, 7)


cell1 = Cell(r1, r2, midribs)
cell1.recalc()
cell2 = Cell(r2, r3, [])
cell2.recalc()

num = 20
#ribs = [cell1.midrib(x*1./num) for x in range(num+1)]
#ribs += [cell2.midrib(x*1./num) for x in range(num+1)]
#G.Graphics3D([G.Line(r1.profile_3d.data),G.Line(r2.profile_3d.data),G.Line([[0.,0.,0.],[1.,0.,0.]]),G.Line([[0.,0.,0.],[0.,0.5,0.]])])
#Graph.Graphics3D([Graph.Line(x.data) for x in ribs])
ribs = []
for x in range(num + 1):
    ribs.append(cell1.midrib(x * 1. / num).data)
for x in range(1, num + 1):
    ribs.append(cell2.midrib(x * 1. / num).data)
ribs = numpy.concatenate(ribs)
polygons = []
points = a.numpoints

for i in range(2 * num):
    for j in range(points - 1):
        polygons.append(
            Graph.Polygon([i * points + j, i * points + j + 1, (i + 1) * points + j + 1, (i + 1) * points + j]))
polygons.append(Graph.Axes(size=0.3))
Graph.Graphics3D(polygons, ribs)
コード例 #7
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)])
コード例 #8
0
 def get_hole(self, x, size=0.4):
     hole = RibHole(x, size=size)
     return Graph.Polygon(hole.get_3d(self.rib))
コード例 #9
0
    def get_gibus_arcs(self, x):
        gibus_arc = GibusArcs(position=x, size=0.02)
        thalist = gibus_arc.get_3d(self.rib, num_points=10)

        return Graph.Polygon(thalist)
コード例 #10
0
 def get_strap(self, x):
     strap = TensionStrap(x, x, 0.02)
     l1, l2 = strap.get_3d(self.cell)
     l1 = l1.data.tolist()
     l2 = l2.data.tolist()
     return Graph.Polygon(l1 + l2[::-1], colour=Graph.Green)