Esempio n. 1
0
def rect(lowerLeftX: float, lowerLeftY: float, width: float, height: float) ->Outline:
    rect = [Point(lowerLeftX, lowerLeftY)]
    rect.append(Point(lowerLeftX+width, lowerLeftY))
    rect.append(Point(lowerLeftX+width, lowerLeftY+height))
    rect.append(Point(lowerLeftX, lowerLeftY+height))
    rectLG = Outline(None)
    rectLG.addLinesFromPoints(rect)
    rectLG.closeShape()
    return rectLG
Esempio n. 2
0
def rectangle(lowerLeftX: float, lowerLeftY: float, X_width: float,
              Y_height: float) -> Outline:
    rect = [Point(lowerLeftX, lowerLeftY)]
    rect.append(Point(lowerLeftX + X_width, lowerLeftY))
    rect.append(Point(lowerLeftX + X_width, lowerLeftY + Y_height))
    rect.append(Point(lowerLeftX, lowerLeftY + Y_height))
    rectLG = Outline(None)
    rectLG.addLinesFromPoints(rect)
    rectLG.closeShape()
    return rectLG
Esempio n. 3
0
def polygon(centerX: float, centerY: float, radius: float, numCorners: int) ->Outline:
    angle = 1.5*math.pi
    points = []
    incAngle = 2*math.pi/numCorners
    for i in range(numCorners):
        x = math.cos(angle+incAngle*i)*radius+centerX
        y = math.sin(angle+incAngle*i)*radius+centerY
        points.append(Point(x,y))
    poly = Outline(None)
    poly.addLinesFromPoints(points)
    poly.closeShape()
    poly = poly.rotate(incAngle/2.0, Point(centerX, centerY))
    return poly
Esempio n. 4
0
def polygon(centerX: float, centerY: float, radius: float,
            numCorners: int) -> Outline:
    angle = 1.5 * math.pi
    points = []
    incAngle = 2 * math.pi / numCorners
    for i in range(numCorners):
        x = math.cos(angle + incAngle * i) * radius + centerX
        y = math.sin(angle + incAngle * i) * radius + centerY
        points.append(Point(x, y))
    poly = Outline(None)
    poly.addLinesFromPoints(points)
    poly.closeShape()
    poly = poly.rotate(incAngle / 2.0, Point(centerX, centerY))
    return poly