How to use the pyclipper.Orientation function in pyclipper

To help you get started, we’ve selected a few pyclipper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github revarbat / mandoline-py / mandoline / geometry2d.py View on Github external
def orient_path(path, dir):
    orient = pyclipper.Orientation(path)
    path = pyclipper.scale_to_clipper(path, SCALING_FACTOR)
    if orient != dir:
        path = pyclipper.ReversePath(path)
    path = pyclipper.scale_from_clipper(path, SCALING_FACTOR)
    return path
github Vivianyzw / PANnet / data_loader.py View on Github external
:param tags:
    :return:
    '''
    (h, w) = input_size
    if polys.shape[0] == 0:
        return [], []
    polys[:, :, 0] = np.clip(polys[:, :, 0], 0, w-1)
    polys[:, :, 1] = np.clip(polys[:, :, 1], 0, h-1)

    validated_polys = []
    validated_tags = []
    for poly, tag in zip(polys, tags):
        if abs(pyclipper.Area(poly)) < 1:
            continue
        #clockwise
        if pyclipper.Orientation(poly):
            poly = poly[::-1]

        validated_polys.append(poly)
        validated_tags.append(tag)
    return np.array(validated_polys), np.array(validated_tags)
github liuheng92 / tensorflow_PSENet / utils / data_provider / data_provider.py View on Github external
:param tags:
    :return:
    '''
    (h, w) = xxx_todo_changeme
    if polys.shape[0] == 0:
        return [], []
    polys[:, :, 0] = np.clip(polys[:, :, 0], 0, w-1)
    polys[:, :, 1] = np.clip(polys[:, :, 1], 0, h-1)

    validated_polys = []
    validated_tags = []
    for poly, tag in zip(polys, tags):
        if abs(pyclipper.Area(poly))<1:
            continue
        #clockwise
        if pyclipper.Orientation(poly):
            poly = poly[::-1]

        validated_polys.append(poly)
        validated_tags.append(tag)
    return np.array(validated_polys), np.array(validated_tags)
github typemytype / booleanOperations / Lib / booleanOperations / flatten.py View on Github external
def __init__(self, pointList):
        if pointList[0] == pointList[-1]:
            del pointList[-1]
        self.clockwise = not pyclipper.Orientation(pointList)
        self.segments = [
            OutputSegment(
                segmentType="flat",
                points=[point]
            ) for point in pointList
        ]