Ejemplo n.º 1
0
    def get_flattened(self, glider, ribs_2d=None, num_points=10):
        # get center point
        profile = glider.ribs[self.rib_no].profile_2d
        start, point_1 = profile.profilepoint(self.pos)
        if self.size_abs:
            point_2 = point_1 + [self.size, 0]
        else:
            __, point_2 = profile.profilepoint(self.pos + self.size)

        gib_arc = [[], []]  # first, second
        circle = polygon(point_1, point_2, num=num_points, is_center=True)[0]
        second = False
        for i in range(len(circle)):
            #print(airfoil.contains_point(circle[i]))
            if profile.contains_point(circle[i]) or \
                    (i < len(circle) - 1 and profile.contains_point(circle[i + 1])) or \
                    (i > 1 and profile.contains_point(circle[i - 1])):
                gib_arc[second].append(circle[i])
            else:
                second = True
        # Cut first and last
        gib_arc = gib_arc[1] + gib_arc[0]  # [secondlist] + [firstlist]
        gib_arc[0], start2, __ = profile.cut(gib_arc[0], gib_arc[1], start)
        gib_arc[-1], stop, __ = profile.cut(gib_arc[-2], gib_arc[-1], start)
        # Append Profile_List
        gib_arc += profile.get(start2, stop).tolist()

        return gib_arc
Ejemplo n.º 2
0
    def get_flattened(self, glider, ribs_2d=None, num_points=10):
        # get center point
        profile = glider.ribs[self.rib_no].profile_2d
        start, point_1 = profile.profilepoint(self.pos)
        if self.size_abs:
            point_2 = point_1 + [self.size, 0]
        else:
            __, point_2 = profile.profilepoint(self.pos + self.size)

        gib_arc = [[], []]  # first, second
        circle = polygon(point_1, point_2, num=num_points, is_center=True)[0]
        second = False
        for i in range(len(circle)):
            #print(airfoil.contains_point(circle[i]))
            if profile.contains_point(circle[i]) or \
                    (i < len(circle) - 1 and profile.contains_point(circle[i + 1])) or \
                    (i > 1 and profile.contains_point(circle[i - 1])):
                gib_arc[second].append(circle[i])
            else:
                second = True
        # Cut first and last
        gib_arc = gib_arc[1] + gib_arc[0]  # [secondlist] + [firstlist]
        gib_arc[0], start2, __ = profile.cut(gib_arc[0], gib_arc[1], start)
        gib_arc[-1], stop, __ = profile.cut(gib_arc[-2], gib_arc[-1], start)
        # Append Profile_List
        gib_arc += profile.get(start2, stop).tolist()

        return gib_arc
Ejemplo n.º 3
0
 def get_flattened(self, glider, num=20):
     rib = glider.ribs[self.rib_no]
     p1 = rib.profile_2d.profilepoint(self.pos)[1]
     p2 = rib.profile_2d.profilepoint(-self.pos)[1]
     return polygon(p1, p2, num=num, size=self.size, is_center=False)[0]
Ejemplo n.º 4
0
 def get_flattened(self, glider, num=20):
     rib = glider.ribs[self.rib_no]
     p1 = rib.profile_2d.profilepoint(self.pos)[1]
     p2 = rib.profile_2d.profilepoint(-self.pos)[1]
     return polygon(p1, p2, num=num, size=self.size, is_center=False)[0]
Ejemplo n.º 5
0
 def test_circle(self):
     self.show(marks.polygon(self.p1, self.p2, num=20))
Ejemplo n.º 6
0
 def test_square(self):
     self.show(marks.polygon(self.p1, self.p2, num=4))