[Numpy-discussion] Creating parallel curves

Chris Barker chris.barker@noaa....
Fri Feb 10 10:53:23 CST 2012


Andrea,

> Basically I have a set of x, y data (around 1,000 elements each) and I
> want to create 2 parallel "curves" (offset curves) to the original
> one; "parallel" means curves which are displaced from the base curve
> by a constant offset, either positive or negative, in the direction of
> the curve's normal. Something like this:
>
> http://pyx.sourceforge.net/examples/drawing2/parallel.html

THis is called "buffering" in GIS parlance -- there are functions
available to do it in GIS an computational geometry libraries: you
might look in the shapely package:

https://github.com/sgillies/shapely

or CGAL

http://www.cgal.org/

If the overhead of these packages is too much, and you still want to
write your own code, try googling:

"buffering a line GIS algorithm" or something like that, and you'll
find pointers.

> But by plotting these thing out with matplotlib it seems to me they
> don't really look very parallel nor very constant-distance.

as we say on the wxPython list -- post a fully functional example, so
we can check it out.

-Chris


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list