Ejemplo n.º 1
0
def generate_img_8a(C=400):
    '''Image "Węzeł z pięcioma prądami"'''
    image = Image((int(C * 2), int(C * 2)), line_width=6, vector_arrow_size=30)
    image.draw_point((C, C), width=20)
    out_param_list = [
        (0, [190, 0, 0]),
        (40, [190, 0, 0]),
        (320, [190, 0, 0]),
    ]
    in_param_list = [
        (140, [0, 20, 190]),
        (180, [0, 20, 190]),
        (220, [0, 20, 190]),
    ]
    for rotation, arrow_color in out_param_list:
        vector = Vector.from_rotation((C, C), rotation, int(C * 0.5))
        vector2 = Vector.from_rotation((C, C), rotation, int(C * 0.5))
        vector2.scale(1.3)
        line = Line.from_vector(vector2)
        image.draw_line(line)
        image.draw_vector(vector, arrow_color=arrow_color)
    for rotation, arrow_color in in_param_list:
        vector = Vector.from_rotation((C, C), rotation, int(C * 0.5))
        vector = Vector.from_reversed(vector)
        vector.scale(1 - (1 / 1.3))
        vector2 = Vector.from_rotation((C, C), rotation, int(C * 0.5))
        vector2.scale(1.3)
        line = Line.from_vector(vector2)
        image.draw_line(line)
        image.draw_vector(vector, arrow_color=arrow_color)
    image.save('img/img_8a.png')
Ejemplo n.º 2
0
def generate_img_5a(C=400):
    '''Image "Symbol ogólny kondensatora"'''
    image = Image((int(C * 2), int(C * 2)), line_width=6)
    image.draw_line(
        Line((int(C * 5 / 6), int(C * 0.5)), (int(C * 5 / 6), int(C * 1.5))))
    image.draw_line(
        Line((int(C * 7 / 6), int(C * 0.5)), (int(C * 7 / 6), int(C * 1.5))))
    image.draw_line(
        Line((int(C * 5 / 6), int(C * 1)), (int(C * 1 / 4), int(C * 1))))
    image.draw_line(
        Line((int(C * 7 / 6), int(C * 1)), (int(C * 7 / 4), int(C * 1))))
    image.draw_point((int(C * 1 / 4), int(C * 1)), width=20)
    image.draw_point((int(C * 7 / 4), int(C * 1)), width=20)
    image.save('img/img_5a.png')
Ejemplo n.º 3
0
def generate_img_5b(C=400):
    '''Image "Symbol kondensatora regulowanego"'''
    image = Image((int(C * 2), int(C * 2)), line_width=6)
    image.draw_line(
        Line((int(C * 5 / 6), int(C * 0.5)), (int(C * 5 / 6), int(C * 1.5))))
    image.draw_line(
        Line((int(C * 7 / 6), int(C * 0.5)), (int(C * 7 / 6), int(C * 1.5))))
    image.draw_line(
        Line((int(C * 5 / 6), int(C * 1)), (int(C * 1 / 4), int(C * 1))))
    image.draw_line(
        Line((int(C * 7 / 6), int(C * 1)), (int(C * 7 / 4), int(C * 1))))
    image.draw_point((int(C * 1 / 4), int(C * 1)), width=20)
    image.draw_point((int(C * 7 / 4), int(C * 1)), width=20)
    image.draw_vector(Vector((int(C * 0.5), int(C * 1.5)),
                             (int(C * 1), -int(C * 1))),
                      width=8)
    image.save('img/img_5b.png')
Ejemplo n.º 4
0
def generate_img_5c(C=400):
    '''Image "Symbol kondensatora elektrolitycznego"'''
    image = Image((int(C * 2), int(C * 2)), line_width=6)
    image.draw_line(
        Line((int(C * 5 / 6), int(C * 0.5)), (int(C * 5 / 6), int(C * 1.5))))
    image.draw_line(
        Line((int(C * 7 / 6), int(C * 0.5)), (int(C * 7 / 6), int(C * 1.5))))
    image.draw_line(
        Line((int(C * 8 / 6), int(C * 0.5)), (int(C * 8 / 6), int(C * 1.5))))
    image.draw_line(
        Line((int(C * 7 / 6), int(C * 0.5)), (int(C * 8 / 6), int(C * 0.5))))
    image.draw_line(
        Line((int(C * 7 / 6), int(C * 1.5)), (int(C * 8 / 6), int(C * 1.5))))
    image.draw_line(
        Line((int(C * 5 / 6), int(C * 1)), (int(C * 1 / 4), int(C * 1))))
    image.draw_line(
        Line((int(C * 8 / 6), int(C * 1)), (int(C * 7 / 4), int(C * 1))))
    image.draw_point((int(C * 1 / 4), int(C * 1)), width=20, fill=[0, 0, 190])
    image.draw_point((int(C * 7 / 4), int(C * 1)), width=20, fill=[190, 0, 0])
    image.save('img/img_5c.png')
Ejemplo n.º 5
0
def generate_img_3a(C=400):
    '''Image "Pole elektryczne pomiędzy odładami kondensatora płaskiego"'''
    image = Image((C * 2, C * 2), line_width=3)
    image.draw_line(Line((int(C*2/3), int(C*0.5)),(int(C*2/3), int(C*1.5))),\
        fill=[190,0,0], width=10)
    image.draw_line(Line((int(C * 2 / 3), C), (int(C * 1 / 3), C)),
                    fill=[190, 0, 0],
                    width=3)
    image.draw_point((int(C * 1 / 3), int(C)), fill=[190, 0, 0], width=10)
    image.draw_line(Line((int(C*4/3), int(C*0.5)),(int(C*4/3), int(C*1.5))),\
        fill=[0,0,190], width=10)
    image.draw_line(Line((int(C * 4 / 3), C), (int(C * 5 / 3), C)),
                    fill=[0, 0, 190],
                    width=3)
    image.draw_point((int(C * 5 / 3), int(C)), fill=[0, 0, 190], width=10)
    len = 2 / 3 - 2 * (0.75 - 2 / 3)
    image.draw_vector(Vector((int(C * 0.75), int(C * 0.6)), (int(C * len), 0)))
    image.draw_vector(Vector((int(C * 0.75), int(C * 0.8)), (int(C * len), 0)))
    image.draw_vector(Vector((int(C * 0.75), int(C * 1)), (int(C * len), 0)))
    image.draw_vector(Vector((int(C * 0.75), int(C * 1.2)), (int(C * len), 0)))
    image.draw_vector(Vector((int(C * 0.75), int(C * 1.4)), (int(C * len), 0)))
    image.save('img/img_3a.png')