comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: interpolation around a contour
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: interpolation around a contour [message #19326] Thu, 09 March 2000 00:00
Mirko Vukovic is currently offline  Mirko Vukovic
Messages: 124
Registered: January 1996
Senior Member
In article <38C6A585.68AC4E2B@bme.jhu.edu>,
isimon@bme.jhu.edu wrote:
> Dear Group:
>
> This is what I have:
>
> I have an xy array of coordinates for a contour (closed contour if you
> connect the points) that has the following properties:
> - arbitrary number of coordinates, they are generally bigger than
200.
> - coordinates are irregularly spaced.
>
> This is what I need:
>
> I need to interpolate points around the old contour so that
>
> - the number of points = a power of 2 = 256
> - interpolated points are equidistantly spaced from one another.
>
> The original and interpolated contour should have the same perimeter
and
> shape.
>
Several solutions come to mind. As someone already pointed out, you can
calculate the euclidean (straight-line) distance between succesive
points, and use that as a parameter t for a spline interpolation of x
vs. t and y vs. t (with appropriate boundary conditions).

If you take a look at Numerical Algorithms with C by Engeln-Mullges and
Uhlig (Springer-Verlag, ISBN 3-540-60530-4), Section 10.1.3, you will
find a discussion and algorithms on this topic. I believe there is a
version of this book with the code in Fortran

They also consider the case when there are sharp turns in the curve,
where a cirle is fitted to three adjacant points. This is a
generalization of the euclidean distance idea.

Another approach I know of is that of Donald Knuth in his work on font
generation. Knuth uses Bezier curves to connect points, and developed
algorithms to calculate the coefficients of the Beziers. (Bezier's are
a special kind of polynomial, in this case fourth order).

Good luck,

Mirko


Sent via Deja.com http://www.deja.com/
Before you buy.
Re: interpolation around a contour [message #19328 is a reply to message #19326] Thu, 09 March 2000 00:00 Go to previous message
Med Bennett is currently offline  Med Bennett
Messages: 109
Registered: April 1997
Senior Member
Just curious - have you experimented with the INTERPOLATE function?
Otherwise, I can see how I would do this with brute force - i.e. loop
through the line segments making up the contour, accumulate euclidean
distance, find the interpolation interval, calculate new coords, etc.
Sounds tedious though.

Inpakala Simon wrote:

> Dear Group:
>
> This is what I have:
>
> I have an xy array of coordinates for a contour (closed contour if you
> connect the points) that has the following properties:
> - arbitrary number of coordinates, they are generally bigger than 200.
> - coordinates are irregularly spaced.
>
> This is what I need:
>
> I need to interpolate points around the old contour so that
>
> - the number of points = a power of 2 = 256
> - interpolated points are equidistantly spaced from one another.
>
> The original and interpolated contour should have the same perimeter and
> shape.
>
> I have tried IDL's technical support and their suggestions did not
> work. I have tried several permutations of TRIGRID, TRIANGULATE,
> Spline_P, and CONGRID. They do not give me the right answer. Perhaps I
> am choosing the wrong keywords?
>
> Any help would be most appreciated.
>
> Regards,
>
> Inpakala Simon
>
> ------------------------------------------------------------ ----------
> - Inpakala Simon - Senior Analyst / Programmer
> - The James Buchanan Brady Urological Institute
> - 600 N. Wolfe St.
> - Baltimore MD 21287
>
> - Voice: 410 614 3815
> - Pager: 410 283 5401
> - Fax: 410 614 8096
> - eMail isimon@bme.jhu.edu
Re: interpolation around a contour [message #19331 is a reply to message #19326] Wed, 08 March 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Inpakala Simon (isimon@bme.jhu.edu) writes:

> I have tried IDL's technical support and their suggestions did not
> work. I have tried several permutations of TRIGRID, TRIANGULATE,
> Spline_P, and CONGRID. They do not give me the right answer. Perhaps I
> am choosing the wrong keywords?
>
> Any help would be most appreciated.

In such cases, I've always found it useful to
reformulate the problem so that it conforms
to one of my solutions. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: silly font problem
Next Topic: Possible FINDFILE bug

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:28:50 PDT 2025

Total time taken to generate the page: 0.00629 seconds