Home Forums Nazca _trapezoid() in nd.util Reply To: _trapezoid() in nd.util


Dear Paul,

The _trapezoid draws a symmetrical trapezoid with base width w0 and top width w1, The central axis between the base and top runs between points xy0 = (x0, y0) and xy1 = (x1, y1). Note that the trapezoid can, therefore, have any orientation in the xy coordinate system. The “top-left” terminology in de docs string (version 0.5.2) is, therefore, relative and depends on the actual start xy0 and end xy1 coordinates. The ‘counter clockwise’ in the doc is also relative and it seems better to remove it. This may be a more clear doc string:

def _trapezoid(xy0, xy1, w0, w1):
    """Calculate the four coordinates of the trapezoid that is defined by the
    line segment through two points xy0 and xy1 with widths w0 and w1.

        xy0 (float, float): point (x,y), segment start
        xy1 (float, float): point (x,y), segment end
        w0 (float): width of line segment start
        w1 (float): width of line segment end

        list of (float, float): list of 4 (float, float) point coordinates (x, y)
        tracing the outline of the trapezoid.