Example #1
0
    def fillPoints(self, command, edge1, edge2, measures):
        step = int(dist.euclidean(edge1[0], edge1[1]) / (measures + 1))
        for i in range(
                measures
        ):  # находим точки на прямоугольнике с двух противоположных сторон
            x0, y0 = Operations.PointsPosition(i, edge1, step)
            if command is 'len':
                self.counturClass.len1_points.append((x0, y0))
            else:
                self.counturClass.wid1_points.append((x0, y0))

            x1, y1 = Operations.PointsPosition(i, edge2, step)
            if command is 'len':
                self.counturClass.len2_points.append((x1, y1))
            else:
                self.counturClass.wid2_points.append((x1, y1))

            ind1, ind2 = Operations.GetIndexes(
                self.counturClass, x0, x1, y0, y1
            )  # находим индексы точек, ближайших к точкам прямоугольника, НО ПРИНАДЛЕЖАЩИХ КОНТУРУ
            # сохраняем эти точки в отдельные массивы

            if command is 'len':
                self.counturClass.len_c_points.append([
                    (self.counturClass.countur[ind1][0][0],
                     self.counturClass.countur[ind1][0][1]),
                    (self.counturClass.countur[ind2][0][0],
                     self.counturClass.countur[ind2][0][1])
                ])
            else:
                self.counturClass.wid_c_points.append([
                    (self.counturClass.countur[ind1][0][0],
                     self.counturClass.countur[ind1][0][1]),
                    (self.counturClass.countur[ind2][0][0],
                     self.counturClass.countur[ind2][0][1])
                ])