def sub_fsd_canvas_graphics(ai_rotation_direction, ai_angle_position):
   # angle position
   l_angle_position = float(ai_angle_position)/100
   #
   r_canvas_graphics = []
   for ol in overlay_figure:
     rotated_ol = cnc_outline.outline_rotate(ol, 0, 0, l_angle_position) # rotation of center (0,0) and angle l_angle_position
     r_canvas_graphics.append(('overlay_lines', outline_arc_line(rotated_ol, 'tkinter'), 'orange', 2))
   for ol in graphic_figure:
     rotated_ol = cnc_outline.outline_rotate(ol, 0, 0, l_angle_position) # rotation of center (0,0) and angle l_angle_position
     r_canvas_graphics.append(('graphic_lines', outline_arc_line(rotated_ol, 'tkinter'), 'red', 1))
   return(r_canvas_graphics)
def flip_rotate_and_translate_figure(
    ai_figure,
    ai_zero_x,
    ai_zero_y,
    ai_size_x,
    ai_size_y,
    ai_x_flip,
    ai_y_flip,
    ai_rotation_angle,
    ai_translate_x,
    ai_translate_y,
):
    """ flip, rotate and translate a figure (list of outlines). Usually used to agglomerate figures to create a cut-set.
  """
    r_figure = []
    for i in range(len(ai_figure)):
        centered_ol = cnc_outline.outline_shift_xy(
            ai_figure[i], -1 * (ai_zero_x + ai_size_x / 2.0), 1, -1 * (ai_zero_y + ai_size_y / 2.0), 1
        )
        flipped_ol = cnc_outline.outline_shift_xy(centered_ol, 0.0, ai_x_flip, 0.0, ai_y_flip)
        # flipped_ol = cnc_outline.outline_shift_xy(centered_ol, 0, ai_x_flip, 0, ai_y_flip) # what makes the most sense? re-shift or not?
        rotated_ol = cnc_outline.outline_rotate(flipped_ol, 0.0, 0.0, ai_rotation_angle)
        translated_ol = cnc_outline.outline_shift_xy(
            rotated_ol, ai_size_x / 2.0 + ai_translate_x, 1, ai_size_y / 2.0 + ai_translate_y, 1
        )
        r_figure.append(translated_ol[:])
    return r_figure
 def sub_fsd_canvas_graphics(ai_rotation_direction, ai_angle_position):
     # angle position
     l_angle_position = float(ai_angle_position) / 100
     #
     r_canvas_graphics = []
     for ol in overlay_figure:
         rotated_ol = cnc_outline.outline_rotate(
             ol, 0, 0, l_angle_position
         )  # rotation of center (0,0) and angle l_angle_position
         r_canvas_graphics.append(
             ('overlay_lines', outline_arc_line(rotated_ol,
                                                'tkinter'), 'orange', 2))
     for ol in graphic_figure:
         rotated_ol = cnc_outline.outline_rotate(
             ol, 0, 0, l_angle_position
         )  # rotation of center (0,0) and angle l_angle_position
         r_canvas_graphics.append(
             ('graphic_lines', outline_arc_line(rotated_ol,
                                                'tkinter'), 'red', 1))
     return (r_canvas_graphics)
Exemple #4
0
def flip_rotate_and_translate_figure(ai_figure, ai_zero_x, ai_zero_y,
                                     ai_size_x, ai_size_y, ai_x_flip,
                                     ai_y_flip, ai_rotation_angle,
                                     ai_translate_x, ai_translate_y):
    """ flip, rotate and translate a figure (list of outlines). Usually used to agglomerate figures to create a cut-set.
  """
    r_figure = []
    for i in range(len(ai_figure)):
        centered_ol = cnc_outline.outline_shift_xy(
            ai_figure[i], -1 * (ai_zero_x + ai_size_x / 2.0), 1,
            -1 * (ai_zero_y + ai_size_y / 2.0), 1)
        flipped_ol = cnc_outline.outline_shift_xy(centered_ol, 0.0, ai_x_flip,
                                                  0.0, ai_y_flip)
        #flipped_ol = cnc_outline.outline_shift_xy(centered_ol, 0, ai_x_flip, 0, ai_y_flip) # what makes the most sense? re-shift or not?
        rotated_ol = cnc_outline.outline_rotate(flipped_ol, 0.0, 0.0,
                                                ai_rotation_angle)
        translated_ol = cnc_outline.outline_shift_xy(
            rotated_ol, ai_size_x / 2.0 + ai_translate_x, 1,
            ai_size_y / 2.0 + ai_translate_y, 1)
        r_figure.append(translated_ol[:])
    return (r_figure)
 def rotate(self, ai_x, ai_y, ai_angle):
   """ create a new outline from the parent one with a rotation of center (ai_x, ai_y) and angle ai_angle
   """
   r_ol = Arc_Line_Outline("{:s}_rotated".format(self.outline_id))
   r_ol.add_piece(cnc_outline.outline_rotate(self.ol, ai_x, ai_y, ai_angle))
   return(r_ol)