From 6065697eb4b8f5014105f9beb7a2f9462368f2a8 Mon Sep 17 00:00:00 2001 From: Amit Aronovitch Date: Sat, 3 Nov 2012 01:51:41 +0200 Subject: [PATCH] delaunay linear_interpolate_grid: enable grid of height/width 1 fixes #997 --- lib/matplotlib/delaunay/_delaunay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/delaunay/_delaunay.cpp b/lib/matplotlib/delaunay/_delaunay.cpp index 074ca139ca2c..395921b2e325 100644 --- a/lib/matplotlib/delaunay/_delaunay.cpp +++ b/lib/matplotlib/delaunay/_delaunay.cpp @@ -289,8 +289,8 @@ static PyObject *linear_interpolate_grid(double x0, double x1, int xsteps, if (!z) return NULL; z_ptr = (double*)PyArray_DATA(z); - dx = (x1 - x0) / (xsteps-1); - dy = (y1 - y0) / (ysteps-1); + dx = ( x1==x0 ? 0 : (x1 - x0) / (xsteps-1) ); + dy = ( y1==y0 ? 0 : (y1 - y0) / (ysteps-1) ); rowtri = 0; for (iy=0; iy