Esempio n. 1
0
    def __roll_support_patch(self, max_val):
        """
        :param max_val: max scale of the plot
        """
        radius = PATCH_SIZE * max_val
        count = 0
        for node in self.system.supports_roll:
            direction = self.system.supports_roll_direction[count]
            x1 = np.cos(np.pi) * radius + node.vertex.x + radius
            z1 = np.sin(np.pi) * radius + node.vertex.y
            x2 = np.cos(np.radians(90)) * radius + node.vertex.x + radius
            z2 = np.sin(np.radians(90)) * radius + node.vertex.y
            x3 = np.cos(np.radians(270)) * radius + node.vertex.x + radius
            z3 = np.sin(np.radians(270)) * radius + node.vertex.y

            triangle = np.array([[x1, z1], [x2, z2], [x3, z3]])

            if node.id in self.system.inclined_roll:
                angle = self.system.inclined_roll[node.id]
                triangle = rotate_xy(triangle, angle + np.pi * 0.5)
                support_patch = plt.Polygon(triangle, color="r", zorder=9)
                self.one_fig.add_patch(support_patch)
                self.one_fig.plot(
                    triangle[1:, 0] - 0.5 * radius * np.sin(angle),
                    triangle[1:, 1] - 0.5 * radius * np.cos(angle),
                    color="r",
                )

            elif direction == 2:  # horizontal roll
                support_patch = mpatches.RegularPolygon(
                    (node.vertex.x, node.vertex.y - radius),
                    numVertices=3,
                    radius=radius,
                    color="r",
                    zorder=9,
                )
                self.one_fig.add_patch(support_patch)
                y = -node.vertex.z - 2 * radius
                self.one_fig.plot(
                    [node.vertex.x - radius, node.vertex.x + radius], [y, y],
                    color="r")
            elif direction == 1:  # vertical roll
                # translate the support to the node

                support_patch = mpatches.Polygon(triangle, color="r", zorder=9)
                self.one_fig.add_patch(support_patch)

                y = node.vertex.y - radius
                self.one_fig.plot(
                    [
                        node.vertex.x + radius * 1.5,
                        node.vertex.x + radius * 1.5
                    ],
                    [y, y + 2 * radius],
                    color="r",
                )
            count += 1
Esempio n. 2
0
    def __roll_support_patch(self, max_val):
        """
        :param max_val: max scale of the plot
        """
        radius = PATCH_SIZE * max_val
        count = 0
        for node in self.system.supports_roll:
            direction = self.system.supports_roll_direction[count]
            x1 = np.cos(np.pi) * radius + node.vertex.x + radius
            z1 = np.sin(np.pi) * radius + node.vertex.y
            x2 = np.cos(np.radians(90)) * radius + node.vertex.x + radius
            z2 = np.sin(np.radians(90)) * radius + node.vertex.y
            x3 = np.cos(np.radians(270)) * radius + node.vertex.x + radius
            z3 = np.sin(np.radians(270)) * radius + node.vertex.y

            triangle = np.array([[x1, z1], [x2, z2], [x3, z3]])

            if node.id in self.system.inclined_roll:
                angle = self.system.inclined_roll[node.id]
                triangle = rotate_xy(triangle, angle + np.pi * 0.5)
                support_patch = plt.Polygon(triangle, color='r',
                                            zorder=9)
                self.one_fig.add_patch(support_patch)
                self.one_fig.plot(triangle[1:, 0] - 0.5 * radius * np.sin(angle), triangle[1:, 1] - 0.5 * radius *
                                  np.cos(angle), color='r')

            elif direction == 2:  # horizontal roll
                support_patch = mpatches.RegularPolygon((node.vertex.x, node.vertex.y - radius),
                                                        numVertices=3, radius=radius, color='r', zorder=9)
                self.one_fig.add_patch(support_patch)
                y = -node.vertex.z - 2 * radius
                self.one_fig.plot([node.vertex.x - radius, node.vertex.x + radius], [y, y], color='r')
            elif direction == 1:  # vertical roll
                # translate the support to the node

                support_patch = mpatches.Polygon(triangle, color='r', zorder=9)
                self.one_fig.add_patch(support_patch)

                y = node.vertex.y - radius
                self.one_fig.plot([node.vertex.x + radius * 1.5, node.vertex.x + radius * 1.5], [y, y + 2 * radius],
                                  color='r')
            count += 1