207    xfrmIDENTITY = [1, 0, 0, 0, 1, 0]  
 
  261        Compose a sequence of matrices together by sequential 
  262        pre-multiplication with the identity matrix. 
  264        @param mats: list of matrices to compose 
  265        @return: the composed transform matrix 
  273                x[0] * mat[0] + x[1] * mat[3],
 
  274                x[0] * mat[1] + x[1] * mat[4],
 
  275                x[0] * mat[2] + x[1] * mat[5] + x[2],
 
  276                x[3] * mat[0] + x[4] * mat[3],
 
  277                x[3] * mat[1] + x[4] * mat[4],
 
  278                x[3] * mat[2] + x[4] * mat[5] + x[5]]
 
 
  311        Set up and return a transform matrix representing a horizontal, 
  312        vertical or both flip about the origin 
  314        @param flip: one of flipNone, flipX, flipY, flipBoth 
  315        @param push: add this transform to the current stack 
  316        @return the generated transform matrix 
  319        if flip == self.
flipX:
 
  320            mat = [-1, 0, 0, 0, 1, 0]
 
  321        elif flip == self.
flipY:
 
  322            mat = [1, 0, 0, 0, -1, 0]
 
  324            mat = [-1, 0, 0, 0, -1, 0]
 
 
  361        Set up and return a transform matrix representing a rotation 
  362        about the origin, and optionally push onto the stack 
  367        @param rot: the rotation angle in degrees 
  368        @param push: add this transform to the current stack 
  369        @return the generated transform matrix 
  371        rads = rot * math.pi / 180
 
  372        mat = [math.cos(rads), -math.sin(rads), 0,
 
  373               math.sin(rads), math.cos(rads), 0]
 
 
  407        Set up and return a transform matrix representing a scale about 
  408        the origin, and optionally push onto the stack 
  413        @param sx: the scale factor in the x direction 
  414        @param sy: the scale factor in the y direction 
  415        @param push: add this transform to the current stack 
  416        @return the generated transform matrix 
  422        mat = [sx, 0, 0, 0, sy, 0]
 
 
  536    def Arc(self, cx, cy, sx, sy, angle):
 
  538        Draw an arc based on centre, start and angle 
  540        The transform matrix is applied 
  542        Note that this won't work properly if the result is not a 
  543        circular arc (e.g. a horizontal scale) 
  545        @param cx: the x coordinate of the arc centre 
  546        @param cy: the y coordinate of the arc centre 
  547        @param sx: the x coordinate of the arc start point 
  548        @param sy: the y coordinate of the arc start point 
  549        @param angle: the arc's central angle (in deci-degrees) 
  552        arc.SetShape(pcbnew.SHAPE_T_ARC)
 
  553        arc.SetWidth(self.
dc[
'lineThickness'])
 
  558        arc.SetLayer(self.
dc[
'layer'])
 
  561        if self.
MyCmp(self.
dc[
'transform'][0], 0) != self.
MyCmp(self.
dc[
'transform'][4], 0):
 
  564        arc.SetCenter(center)
 
  566        arc.SetArcAngleAndEnd(angle, 
True)
 
 
  680        Circle radius r centred at (x, y) with a raised or depressed notch 
  682        Notch height is measured from the top of the circle radius 
  684        @param x: the x coordinate of the circle's centre 
  685        @param y: the y coordinate of the circle's centre 
  686        @param r: the radius of the circle 
  687        @param notch_w: the width of the notch 
  688        @param notch_h: the height of the notch 
  689        @param rotate: the rotation of the whole figure, in degrees 
  695        angle_intercept = math.asin(notch_w/(2 * r))
 
  698        sx = math.sin(angle_intercept) * r
 
  699        sy = -math.cos(angle_intercept) * r
 
  702        arc_angle = (math.pi * 2 - angle_intercept * 2) * (1800/math.pi)
 
  704        self.
Arc(x, y, sx, sy, arc_angle)
 
 
  716        Draw a box with a notch in the centre of the top edge 
  718        @param x: the x coordinate of the circle's centre 
  719        @param y: the y coordinate of the circle's centre 
  720        @param w: the width of the box 
  721        @param h: the height of the box 
  722        @param notchW: the width of the notch 
  723        @param notchH: the height of the notch 
  724        @param rotate: the rotation of the whole figure, in degrees 
  730        notchW = min(x + w/2, notchW)
 
  740            (notchW/2, y - h/2 + notchH),
 
  741            (-notchW/2, y - h/2 + notchH),
 
  742            (-notchW/2, y - h/2),
 
 
  749                                setback=pcbnew.FromMM(1.27), flip=flipNone):
 
  751        Draw a box with a diagonal at the top left corner. 
  753        @param x: the x coordinate of the circle's centre 
  754        @param y: the y coordinate of the circle's centre 
  755        @param w: the width of the box 
  756        @param h: the height of the box 
  757        @param setback: the set-back of the diagonal, in both x and y 
  758        @param flip: one of flipNone, flipX, flipY or flipBoth to change the 
  764        pts = [[x - w/2 + setback, y - h/2],
 
  765               [x - w/2,           y - h/2 + setback],
 
  769               [x - w/2 + setback, y - h/2]]
 
 
  804        Draw a box with rounded corners (i.e. a 90-degree circular arc) 
  806        :param x: the x coordinate of the box's centre 
  807        :param y: the y coordinate of the box's centre 
  808        :param w: the width of the box 
  809        :param h: the height of the box 
  810        :param rad: the radius of the corner rounds 
  813        x_inner = w - rad * 2
 
  814        y_inner = h - rad * 2
 
  820        self.
HLine(x_left + rad, y_top, x_inner)
 
  821        self.
HLine(x_left + rad, -y_top, x_inner)
 
  823        self.
VLine(x_left, y_top + rad, y_inner)
 
  824        self.
VLine(-x_left, y_top + rad, y_inner)
 
  832        self.
Arc(+cx, +cy, +x_left, +cy, +ninety_deg)
 
  833        self.
Arc(-cx, +cy, -x_left, +cy, -ninety_deg)
 
  834        self.
Arc(+cx, -cy, +x_left, -cy, -ninety_deg)
 
  835        self.
Arc(-cx, -cy, -x_left, -cy, +ninety_deg)
 
 
  839        Draw a box with chamfered corners. 
  841        :param x: the x coordinate of the box's centre 
  842        :param y: the y coordinate of the box's centre 
  843        :param w: the width of the box 
  844        :param h: the height of the box 
  845        :param chamfer_x: the size of the chamfer set-back in the x direction 
  846        :param chamfer_y: the size of the chamfer set-back in the y direction 
  853        x_inner = x_left + chamfer_x
 
  854        y_inner = y_top + chamfer_y