Пример #1
0
    def pixel2coords(self, x, y):
        if x < 0 or x > self.pixbuf.get_width() \
        or y < 0 or y > self.pixbuf.get_height():
            return None
        if self.A is None or self.H is None or self.V is None:
            return None

        sin = math.sin(self.to)
        cos = math.cos(self.to)

        x1 = (x - self.A[0][0]) * self.dflo
        y1 = (y - self.A[0][1]) * self.dfla
        x, y = x1, y1

        x1 = x / math.sin(self.raca) + y * math.cos(self.raca)
        y1 = y
        x, y = x1, y1

        x1 = (y * sin - x * cos) / (sin*sin + cos*cos)
        y1 = (y * cos + x * sin) / (sin*sin + cos*cos)
        x, y = x1, y1

        v = Vect.vsum(Vect.vect(x1, y1), self.A[1])

        return [v[1], v[0]]