[Numpy-discussion] "trapezoidal" grids

Stéfan van der Walt stefan@sun.ac...
Fri Feb 10 23:45:50 CST 2012


On Fri, Feb 10, 2012 at 9:26 AM, Hugo Gagnon
<sourceforge.numpy@user.fastmail.fm> wrote:
> Hello,
>
> Say I have four corner points a = (X0, Y0), b = (X1, Y1), c = (X2, Y2)
> and d = (X3, Y3):
>
> a----------b
>  \        /
>  \      /
>   c----d
>
> Is there a function like meshgrid that would return me a grid of points
> linearly interpolating those four corner points?

It depends on what you mean by "linearly interpolating".  For example,
you can construct a regular grid and simply discard points outside the
trapesium, or assume that the trapesium is a "warped perspective" on a
regular grid.  For the latter case, you can construct a grid like
this:

http://mentat.za.net/refer/np_warped_grid.png

(code attached)

Stéfan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quad_grid.py
Type: text/x-python
Size: 898 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120210/7a815806/attachment.py 


More information about the NumPy-Discussion mailing list