Exemple #1
0
 def show(self, scale, offset):
     ''' 
         0.5  = a*x + b*y + c
         (0.5 - c) = a*x + b*y
         y = (0.5 - c - a * x)/ b
         x[1] = (0.5 - c - w[0] * x[0]) / w[1]
     '''
     x0 = offset
     y0 = (0.5 - self.b) / self.w[1] * scale + offset
     y1 = (0.5 - self.b - self.w[0]) / self.w[1] * scale + offset
     x1 = scale + offset
     line(x0, y0, x1, y1, color=(0, 0, 255, 255))
Exemple #2
0
    def create_shape(self,
                     name,
                     shape,
                     coordinates,
                     rgba=Gdk.RGBA(0, 0, 0, 1),
                     step=0):
        ''' Create a shape and draw it according to it's ppc
        Args:
            name: name of the shape (as in the object's name)
            shape: what shape it belongs
            coordinates: points that discribe the shape
            rgba: object color
            step: used to render curves. set the step for the drawing
        '''

        rgba = rgba_to_tuple(rgba)
        if shape == "Ponto":
            obj = shapes.point(coordinates, rgba)
        elif shape == "Linha":
            obj = shapes.line(coordinates, rgba)
        elif shape == "Poligono":
            obj = shapes.polygon(coordinates, rgba)
        elif shape == "Bezier":
            obj = shapes.Bezier(coordinates, step, rgba)
        else:
            obj = shapes.Bspline(coordinates, rgba)

        # add to display file
        self.obj_list[name] = obj
        self.calculate_ppc()
Exemple #3
0
 def show(self):
     '''Shows the survivor.'''
     self.label.text = '{}'.format(self.score)
     self.label.draw()
     alpha = int(self.f(self.health))
     angle = algelin.heading(self.vel)
     glPushMatrix()
     glTranslatef(self.pos[0] + self.size/2, self.pos[1] + self.size/3, 0.0)
     glRotatef(angle, 0, 0, 1)
     glTranslatef(-self.pos[0] - self.size/2, -self.pos[1] - self.size/3, 0.)
     shapes.triangle(self.pos[0]-2, self.pos[1]-2, self.size, angle=angle, color=(0, 0, 0, alpha+30))
     if self.debug:
         shapes.ring(self.pos[0]+self.size/2, self.pos[1]+self.size/3, self.perception[0], color=(100, 255, 0, alpha))
         shapes.ring(self.pos[0]+self.size/2, self.pos[1]+self.size/3, self.perception[1], color=(255, 100, 0, alpha))
         shapes.line(self.pos[0]+self.size/3, self.pos[1]+self.size/3, self.atraction[0], color=(100, 255, 0, alpha))
         shapes.line(self.pos[0]+self.size/3, self.pos[1]+self.size/3, self.atraction[1], color=(255, 100, 0, alpha))
     glPopMatrix()
Exemple #4
0
def init_spines():
    '''
    empty lines
    '''
    lns = [
        line(*spine_from_quad(q), color=clr)
        for q, clr in zip(ALL_QUADS, ALL_COLORS)
    ]
    return (lns)
Exemple #5
0
 def show(self, scale, offset):
     b = self.b * scale + offset
     a = self.a * scale + offset
     ab = (self.a + self.b) * scale + offset
     line(b, offset, ab, scale + offset, color=(0, 0, 255, 255))
                    if sublist[1] != 0:
                        overlaps_path = fc.checkoverlaps(num, list_location_path, overlaps_path)
                        list_location_path.append(num)

                    if sublist[1] == 2 or sublist[1] == 1:
                        fill = '#FF6D8F'  # pink
                        stroke = '#960c2c'
                        if sublist[2] == 2:  # nonsense
                            fill = '#FFFF8E'  # yellow
                            stroke = '#ffaa00'
                        elif sublist[2] == 1:  # gly
                            fill = '#91bdff'  # blue
                            stroke = '#004ec4'
                        if overlaps_path == 0:
                            f.write(shapes.triangle(line2, num, fill, stroke))
                            f.write(shapes.line(line2, num, stroke))
                        else:
                            line2 = 278 - (overlaps_path * 9)
                            f.write(shapes.overlap_triangle(line2, num, fill, stroke))
                    elif sublist[1] == 0:
                        fill = '#c8ff72'  # green
                        stroke = '#5d8c15'
                    if overlaps == 0:
                        f.write(shapes.triangle(line1, num, fill, stroke))
                        f.write(shapes.line(line1, num, stroke))
                    elif len(edits_list) != 0:
                        line1 = 170 - (overlaps * 9)
                        f.write(shapes.overlap_triangle(line1, num, fill, stroke))
                    else:
                        line1 = 178 - (overlaps * 9)
                        f.write(shapes.overlap_triangle(line1, num, fill, stroke))