Home Forums Nazca quasi-curved polygon! Reply To: quasi-curved polygon!


Dear sara,

The pins are more useful in the context of connecting building blocks, rather than defining polygon structures.

To answer the polygon part if for some reason you want to use pins:

The point keyword in Polygon accepts a list of (x, y) describing the polygon points in order as drawn.

Note that curve.pin[‘a0’] does not describe the curve. It is a point (pin) to reference a position with respect to the curve. If you want to use a pin position in a polygon (unlikely), use the pin’s xya method:

import nazca as nd

p1 = nd.Pin('a0').put(10, 20, 30)
x1, y1, a1 = p1.xya()

x2, y2, a2 = nd.Pin('b0').put(10, -20, -30).xya()

nd.Polygon(points=[(0,0), (x1, y1), (x2, y2)], layer=1)

You need to create a polygon that “carves-out” the desired shape along the outline of the blue structure in your picture. See the next example, and note that the “filled” structure is on the “left side” of the line that defines the polygon. Orientation of the outline matters.

import nazca as nd

points = [(-1, 1), (1, 1), (1, -1), (-1, -1), (-1, 1), (-2, -2), (2, -2), (2, 2), (-2, 2), (-2, -2)]