Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def perform_extend(i, sx, tx, sy, ty, xmin, xmax, ymin, ymax, plot_start,
xs, ys0, ys1, *aggs_and_cols):
x0 = xs[i]
x1 = xs[i + 1]
y0 = ys0[i]
y1 = ys1[i]
y2 = ys1[i + 1]
y3 = ys0[i + 1]
trapezoid_start = (plot_start if i == 0 else
(isnull(xs[i - 1]) or
isnull(ys0[i - 1]) or
isnull(ys1[i - 1])))
stacked = True
draw_trapezoid_y(
i, sx, tx, sy, ty, xmin, xmax, ymin, ymax,
x0, x1, y0, y1, y2, y3, trapezoid_start, stacked,
*aggs_and_cols
)
def perform_extend_line(
i, j, sx, tx, sy, ty, xmin, xmax, ymin, ymax, xs, ys, *aggs_and_cols
):
x0 = xs[i, j]
y0 = ys[j]
x1 = xs[i, j + 1]
y1 = ys[j + 1]
segment_start = (
(j == 0) or isnull(xs[i, j - 1]) or isnull(ys[j - 1])
)
draw_segment(i, sx, tx, sy, ty, xmin, xmax, ymin, ymax,
segment_start, x0, x1, y0, y1, *aggs_and_cols)
def perform_extend_line(
i, j, sx, tx, sy, ty, xmin, xmax, ymin, ymax, xs, ys, *aggs_and_cols
):
x0 = xs[j]
y0 = ys[i, j]
x1 = xs[j + 1]
y1 = ys[i, j + 1]
segment_start = (
(j == 0) or isnull(xs[j - 1]) or isnull(ys[i, j - 1])
)
draw_segment(i, sx, tx, sy, ty, xmin, xmax, ymin, ymax,
segment_start, x0, x1, y0, y1, *aggs_and_cols)
def perform_extend_line(
i, j, sx, tx, sy, ty, xmin, xmax, ymin, ymax,
xs, ys, *aggs_and_cols
):
x0 = xs[i, j]
y0 = ys[i, j]
x1 = xs[i, j + 1]
y1 = ys[i, j + 1]
segment_start = (
(j == 0) or isnull(xs[i, j - 1]) or isnull(ys[i, j - 1])
)
draw_segment(i, sx, tx, sy, ty, xmin, xmax, ymin, ymax,
segment_start, x0, x1, y0, y1, *aggs_and_cols)
def draw_segment(
i, sx, tx, sy, ty, xmin, xmax, ymin, ymax, segment_start,
x0, x1, y0, y1, *aggs_and_cols
):
"""Draw a line segment using Bresenham's algorithm
This method plots a line segment with integer coordinates onto a pixel
grid.
"""
skip = False
# If any of the coordinates are NaN, there's a discontinuity.
# Skip the entire segment.
if isnull(x0) or isnull(y0) or isnull(x1) or isnull(y1):
skip = True
# Use Liang-Barsky (1992) to clip the segment to a bounding box
# Check if line is fully outside viewport
if x0 < xmin and x1 < xmin:
skip = True
elif x0 > xmax and x1 > xmax:
skip = True
elif y0 < ymin and y1 < ymin:
skip = True
elif y0 > ymax and y1 > ymax:
skip = True
t0, t1 = 0, 1
dx1 = x1 - x0
t0, t1, accept = _clipt(-dx1, x0 - xmin, t0, t1)
def perform_extend(
i, j, sx, tx, sy, ty, xmin, xmax, ymin, ymax,
xs, ys, *aggs_and_cols
):
x0 = xs[i, j]
x1 = xs[i, j + 1]
y0 = ys[i, j]
y1 = 0.0
y2 = 0.0
y3 = ys[i, j + 1]
trapezoid_start = (j == 0 or
isnull(xs[i, j - 1]) or
isnull(ys[i, j - 1]))
stacked = False
draw_trapezoid_y(
i, sx, tx, sy, ty, xmin, xmax, ymin, ymax,
x0, x1, y0, y1, y2, y3, trapezoid_start, stacked, *aggs_and_cols
)
def perform_extend(
i, j, sx, tx, sy, ty, xmin, xmax, ymin, ymax,
xs, ys, *aggs_and_cols
):
x0 = xs[i, j]
x1 = xs[i, j + 1]
y0 = ys[i, j]
y1 = 0.0
y2 = 0.0
y3 = ys[i, j + 1]
trapezoid_start = (j == 0 or
isnull(xs[i, j - 1]) or
isnull(ys[i, j - 1]))
stacked = False
draw_trapezoid_y(
i, sx, tx, sy, ty, xmin, xmax, ymin, ymax,
x0, x1, y0, y1, y2, y3, trapezoid_start, stacked, *aggs_and_cols
)
def perform_extend(i, j, sx, tx, sy, ty, xmin, xmax, ymin, ymax,
xs, ys, *aggs_and_cols):
x0 = xs[j]
x1 = xs[j + 1]
y0 = ys[i, j]
y1 = 0.0
y2 = 0.0
y3 = ys[i, j + 1]
trapezoid_start = (j == 0 or
isnull(xs[j - 1]) or
isnull(ys[i, j - 1]))
stacked = False
draw_trapezoid_y(
i, sx, tx, sy, ty, xmin, xmax, ymin, ymax,
x0, x1, y0, y1, y2, y3, trapezoid_start, stacked,
*aggs_and_cols
)