示例#1
0
    def draw_vector(self, vector: Vector, starting_point: Point):
        # Flip y since 0 0 is at top
        unscaled_vector_to_draw = BridgeGUI.flip_vector_on_y(
            vector).get_unit_vector()

        vector_tail = Vector.from_point(self.scale_point(starting_point))
        vector_tip = unscaled_vector_to_draw * BridgeGUI.LENGTH_OF_VECTOR + vector_tail
        label_position = vector_tail + unscaled_vector_to_draw * BridgeGUI.LENGTH_TO_LABEL

        self.draw_line(vector_tail, vector_tip, arrow=True)
        self.draw_label(label_position, vector.get_magnitude().rescale(kN))
示例#2
0
 def draw_beams(self, bridge: BridgeCalculator):
     for beam, beam_property in bridge.bridge.beams.items():
         self.draw_line(self.scale_point(beam.joint1),
                        self.scale_point(beam.joint2),
                        color=beam_property.beam_group.color)
         if beam_property.member_force is not None:
             label_position = Vector.from_point(
                 self.scale_point(
                     beam.joint2)) + BridgeGUI.flip_vector_on_y(
                         Vector.from_a_to_b(beam.joint2, beam.joint1)
                     ) / 2 * self.scale_factor
             self.draw_label(label_position,
                             beam_property.member_force.rescale(kN))