evenly spaced vector [message #81182] |
Tue, 21 August 2012 11:21  |
sivan
Messages: 13 Registered: August 2012
|
Junior Member |
|
|
hi all.
i encountered an internet problem so i'll send the post again.
i have x and y points that describe an open curve in 2D space but this curve doesn't be represented by functions. lets say it is a random curve.
what i wanted to do is to place evenly spaced points along this curve.
to do this, i modified the arcsample (http://www.idlcoyote.com/programs/arcsample.pro) procedure for open curves but it did not exactly work. this procedure doesn't create points evenly spaced.
if you pleased, i'll send you my code and data.
by the way, sorry for my english.
kind regards,
sivan.
|
|
|
|
|
Re: evenly spaced vector [message #81311 is a reply to message #81182] |
Fri, 07 September 2012 07:06   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Friday, September 7, 2012 3:17:58 AM UTC-4, sivan wrote:
> On Thursday, September 6, 2012 10:41:22 PM UTC+3, Craig Markwardt wrote:
...
>
>> The points are equally spaced in path length, where path length between data values is defined by the pythagorean theorem. It's doing what you asked it to do. But the pythagorean theorem doesn't really make sense when X is tempoerature and Y is log_g, does it?
>
>>
>
>>
>
>>
>
>> If you want equidistantly sampled points in *plot* space, then you need to transform to device coordinates first, then do your arcsampling.
>
>>
>
>>
>
>>
>
>> Some warnings. ARCSAMPLE uses SPL_INTERP(), which has some overshoot for rapidly varying functions like yours. You may not want that. Also, you used David's original code which sets the endpoint slopes to AVGSLOPEX and AVGSLOPEY, but that assumes that it's still a closed curve. Yours is not a closed curve. For your open curves, you should revert to natural splines where the slope is not specified at the endpoints.
...
>
>
> by the way, i visited your homepage and found out that you were a PhD student of Hakkı Ögelman. He was one of the most precious professors in my country, Turkey.
Thanks for your kind words.
> whatever, as you mentioned above, pythagorean theorem doesn't make sense.
>
> do you have any idea how to do what i wanted?
Yes. I described it above. "If you want equidistant points in plot space..."
CM
|
|
|
Re: evenly spaced vector [message #81319 is a reply to message #81182] |
Fri, 07 September 2012 00:17   |
sivan
Messages: 13 Registered: August 2012
|
Junior Member |
|
|
On Thursday, September 6, 2012 10:41:22 PM UTC+3, Craig Markwardt wrote:
> On Thursday, September 6, 2012 1:23:51 PM UTC-4, sivan wrote:
>
>> On Thursday, September 6, 2012 5:00:29 PM UTC+3, Craig Markwardt wrote:
>
>>
>
>>> On Thursday, September 6, 2012 7:22:21 AM UTC-4, sivan wrote:
>
>>
>
>>>
>
>>
>
>>>> On Sunday, September 2, 2012 11:46:56 PM UTC+3, Craig Markwardt wrote:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>> i appreciated for your reply.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> it doesn't matter whether I use arcsample or not.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> the problem is that i don't place evenly spaced points along the curve.
>
>>
>
>>>
>
>>
>
>>>>
>
>>
>
>>>
>
>>
>
>>>> modified or unmodified arcsample routine doesn't work as requested. i tried both.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> I tried this example:
>
>>
>
>>>
>
>>
>
>>> x0 = randomn(seed,5) & y0 = randomn(seed,5)
>
>>
>
>>>
>
>>
>
>>> arcsample, x0, y0, x, y
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> plot, x0, y0 & oplot, x, y, psym=1
>
>>
>
>>>
>
>>
>
>>> plot, sqrt((x(1:*)-x)^2 + (y(1:*)-y)^2)
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> It looks evenly spaced to me.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> The points are evenly spaced along the (spline interpolation) path, but that does not necessarily mean equally distant from each other (linear interpolation).
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> ARCSAMPLE up-samples by a factor of 100. If you modify that to a larger and larger number, then neighbor points will tend to be more and more equidistant.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> CM
>
>>
>
>>
>
>>
>
>> this is the graphic:
>
>>
>
>> https://docs.google.com/open?id=0B8iEehZBld1OLUVXdndEQ2RwcE0
>
>>
>
>>
>
>>
>
>> as you can see, arcsample doesn't work properly. moreover, some points fall outside the curve.
>
>>
>
>>
>
>>
>
>> this is the code and the data:
>
>>
>
>> https://docs.google.com/open?id=0B8iEehZBld1OaEI5UkJiTVFkelk
>
>>
>
>>
>
>>
>
>> inform me if links are broken.
>
>
>
> The points are equally spaced in path length, where path length between data values is defined by the pythagorean theorem. It's doing what you asked it to do. But the pythagorean theorem doesn't really make sense when X is tempoerature and Y is log_g, does it?
>
>
>
> If you want equidistantly sampled points in *plot* space, then you need to transform to device coordinates first, then do your arcsampling.
>
>
>
> Some warnings. ARCSAMPLE uses SPL_INTERP(), which has some overshoot for rapidly varying functions like yours. You may not want that. Also, you used David's original code which sets the endpoint slopes to AVGSLOPEX and AVGSLOPEY, but that assumes that it's still a closed curve. Yours is not a closed curve. For your open curves, you should revert to natural splines where the slope is not specified at the endpoints.
>
>
>
> Craig
hello again dr.
by the way, i visited your homepage and found out that you were a PhD student of Hakkı Ögelman. He was one of the most precious professors in my country, Turkey.
whatever, as you mentioned above, pythagorean theorem doesn't make sense.
do you have any idea how to do what i wanted?
best regards,
sivan.
|
|
|
Re: evenly spaced vector [message #81327 is a reply to message #81182] |
Thu, 06 September 2012 12:41   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Thursday, September 6, 2012 1:23:51 PM UTC-4, sivan wrote:
> On Thursday, September 6, 2012 5:00:29 PM UTC+3, Craig Markwardt wrote:
>
>> On Thursday, September 6, 2012 7:22:21 AM UTC-4, sivan wrote:
>
>>
>
>>> On Sunday, September 2, 2012 11:46:56 PM UTC+3, Craig Markwardt wrote:
>
>>
>
>>
>
>>
>
>>> i appreciated for your reply.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> it doesn't matter whether I use arcsample or not.
>
>>
>
>>>
>
>>
>
>>> the problem is that i don't place evenly spaced points along the curve.
>
>>
>
>>>
>
>>
>
>>> modified or unmodified arcsample routine doesn't work as requested. i tried both.
>
>>
>
>>
>
>>
>
>> I tried this example:
>
>>
>
>> x0 = randomn(seed,5) & y0 = randomn(seed,5)
>
>>
>
>> arcsample, x0, y0, x, y
>
>>
>
>>
>
>>
>
>> plot, x0, y0 & oplot, x, y, psym=1
>
>>
>
>> plot, sqrt((x(1:*)-x)^2 + (y(1:*)-y)^2)
>
>>
>
>>
>
>>
>
>> It looks evenly spaced to me.
>
>>
>
>>
>
>>
>
>> The points are evenly spaced along the (spline interpolation) path, but that does not necessarily mean equally distant from each other (linear interpolation).
>
>>
>
>>
>
>>
>
>> ARCSAMPLE up-samples by a factor of 100. If you modify that to a larger and larger number, then neighbor points will tend to be more and more equidistant.
>
>>
>
>>
>
>>
>
>> CM
>
>
>
> this is the graphic:
>
> https://docs.google.com/open?id=0B8iEehZBld1OLUVXdndEQ2RwcE0
>
>
>
> as you can see, arcsample doesn't work properly. moreover, some points fall outside the curve.
>
>
>
> this is the code and the data:
>
> https://docs.google.com/open?id=0B8iEehZBld1OaEI5UkJiTVFkelk
>
>
>
> inform me if links are broken.
The points are equally spaced in path length, where path length between data values is defined by the pythagorean theorem. It's doing what you asked it to do. But the pythagorean theorem doesn't really make sense when X is tempoerature and Y is log_g, does it?
If you want equidistantly sampled points in *plot* space, then you need to transform to device coordinates first, then do your arcsampling.
Some warnings. ARCSAMPLE uses SPL_INTERP(), which has some overshoot for rapidly varying functions like yours. You may not want that. Also, you used David's original code which sets the endpoint slopes to AVGSLOPEX and AVGSLOPEY, but that assumes that it's still a closed curve. Yours is not a closed curve. For your open curves, you should revert to natural splines where the slope is not specified at the endpoints.
Craig
|
|
|
Re: evenly spaced vector [message #81330 is a reply to message #81182] |
Thu, 06 September 2012 10:22   |
sivan
Messages: 13 Registered: August 2012
|
Junior Member |
|
|
On Thursday, September 6, 2012 5:00:29 PM UTC+3, Craig Markwardt wrote:
> On Thursday, September 6, 2012 7:22:21 AM UTC-4, sivan wrote:
>
>> On Sunday, September 2, 2012 11:46:56 PM UTC+3, Craig Markwardt wrote:
>
>
>
>> i appreciated for your reply.
>
>>
>
>>
>
>>
>
>> it doesn't matter whether I use arcsample or not.
>
>>
>
>> the problem is that i don't place evenly spaced points along the curve.
>
>>
>
>> modified or unmodified arcsample routine doesn't work as requested. i tried both.
>
>
>
> I tried this example:
>
> x0 = randomn(seed,5) & y0 = randomn(seed,5)
>
> arcsample, x0, y0, x, y
>
>
>
> plot, x0, y0 & oplot, x, y, psym=1
>
> plot, sqrt((x(1:*)-x)^2 + (y(1:*)-y)^2)
>
>
>
> It looks evenly spaced to me.
>
>
>
> The points are evenly spaced along the (spline interpolation) path, but that does not necessarily mean equally distant from each other (linear interpolation).
>
>
>
> ARCSAMPLE up-samples by a factor of 100. If you modify that to a larger and larger number, then neighbor points will tend to be more and more equidistant.
>
>
>
> CM
this is the graphic:
https://docs.google.com/open?id=0B8iEehZBld1OLUVXdndEQ2RwcE0
as you can see, arcsample doesn't work properly. moreover, some points fall outside the curve.
this is the code and the data:
https://docs.google.com/open?id=0B8iEehZBld1OaEI5UkJiTVFkelk
inform me if links are broken.
|
|
|
Re: evenly spaced vector [message #81336 is a reply to message #81182] |
Thu, 06 September 2012 07:00   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Thursday, September 6, 2012 7:22:21 AM UTC-4, sivan wrote:
> On Sunday, September 2, 2012 11:46:56 PM UTC+3, Craig Markwardt wrote:
> i appreciated for your reply.
>
>
>
> it doesn't matter whether I use arcsample or not.
>
> the problem is that i don't place evenly spaced points along the curve.
>
> modified or unmodified arcsample routine doesn't work as requested. i tried both.
I tried this example:
x0 = randomn(seed,5) & y0 = randomn(seed,5)
arcsample, x0, y0, x, y
plot, x0, y0 & oplot, x, y, psym=1
plot, sqrt((x(1:*)-x)^2 + (y(1:*)-y)^2)
It looks evenly spaced to me.
The points are evenly spaced along the (spline interpolation) path, but that does not necessarily mean equally distant from each other (linear interpolation).
ARCSAMPLE up-samples by a factor of 100. If you modify that to a larger and larger number, then neighbor points will tend to be more and more equidistant.
CM
|
|
|
Re: evenly spaced vector [message #81338 is a reply to message #81267] |
Thu, 06 September 2012 04:22   |
sivan
Messages: 13 Registered: August 2012
|
Junior Member |
|
|
On Sunday, September 2, 2012 11:46:56 PM UTC+3, Craig Markwardt wrote:
> On Sunday, September 2, 2012 10:27:47 AM UTC-4, sivan wrote:
>
>> will anyone help me?
>
>
>
> Probably not. Nobody knows how you modified ARCSAMPLE, so they have no way to speculate on how to solve it. And most people don't want to debug someone else's programs.
>
>
>
> Why don't you use ARCSAMPLE unmodified? It will return values for a closed curve, and you want an open curve. But you can post-process the points after it returns.
>
>
>
> CM
i appreciated for your reply.
it doesn't matter whether I use arcsample or not.
the problem is that i don't place evenly spaced points along the curve.
modified or unmodified arcsample routine doesn't work as requested. i tried both.
best wishes,
sivan.
|
|
|
Re: evenly spaced vector [message #81394 is a reply to message #81182] |
Fri, 07 September 2012 20:40   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Friday, September 7, 2012 3:40:25 PM UTC-4, sivan wrote:
> On Friday, September 7, 2012 5:06:48 PM UTC+3, Craig Markwardt wrote:
...
>>>> If you want equidistantly sampled points in *plot* space, then you need to transform to device coordinates first, then do your arcsampling.
...
>>>> Some warnings. ARCSAMPLE uses SPL_INTERP(), which has some overshoot for rapidly varying functions like yours. You may not want that. Also, you used David's original code which sets the endpoint slopes to AVGSLOPEX and AVGSLOPEY, but that assumes that it's still a closed curve. Yours is not a closed curve. For your open curves, you should revert to natural splines where the slope is not specified at the endpoints.
...
>> Yes. I described it above. "If you want equidistant points in plot space..."
...
> yes. i'd be perfect if i could place equidistant points along the curve (isochrone).
>
> you said that i needed to transform to device coordinates first, then did my arcsampling. it seems a little complicated to me. how can i do it?
Read about the IDL function CONVERT_COORD. You have data in DATA space and want to convert to DEVICE space before arcsampling.
|
|
|
Re: evenly spaced vector [message #81400 is a reply to message #81311] |
Fri, 07 September 2012 12:40   |
sivan
Messages: 13 Registered: August 2012
|
Junior Member |
|
|
On Friday, September 7, 2012 5:06:48 PM UTC+3, Craig Markwardt wrote:
> On Friday, September 7, 2012 3:17:58 AM UTC-4, sivan wrote:
>
>> On Thursday, September 6, 2012 10:41:22 PM UTC+3, Craig Markwardt wrote:
>
> ...
>
>>
>
>>> The points are equally spaced in path length, where path length between data values is defined by the pythagorean theorem. It's doing what you asked it to do. But the pythagorean theorem doesn't really make sense when X is tempoerature and Y is log_g, does it?
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> If you want equidistantly sampled points in *plot* space, then you need to transform to device coordinates first, then do your arcsampling.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Some warnings. ARCSAMPLE uses SPL_INTERP(), which has some overshoot for rapidly varying functions like yours. You may not want that. Also, you used David's original code which sets the endpoint slopes to AVGSLOPEX and AVGSLOPEY, but that assumes that it's still a closed curve. Yours is not a closed curve. For your open curves, you should revert to natural splines where the slope is not specified at the endpoints.
>
> ...
>
>>
>
>>
>
>> by the way, i visited your homepage and found out that you were a PhD student of Hakkı Ögelman. He was one of the most precious professors in my country, Turkey.
>
>
>
> Thanks for your kind words.
>
>
>
>> whatever, as you mentioned above, pythagorean theorem doesn't make sense.
>
>>
>
>> do you have any idea how to do what i wanted?
>
>
>
> Yes. I described it above. "If you want equidistant points in plot space..."
>
>
>
> CM
yes. i'd be perfect if i could place equidistant points along the curve (isochrone).
you said that i needed to transform to device coordinates first, then did my arcsampling. it seems a little complicated to me. how can i do it?
thanks in advice,
sivan.
|
|
|
Re: evenly spaced vector [message #81482 is a reply to message #81394] |
Wed, 19 September 2012 08:41  |
sivan
Messages: 13 Registered: August 2012
|
Junior Member |
|
|
thanks for the reply.
i'll try your advise.
kind regard,
sivan.
On Saturday, September 8, 2012 6:40:19 AM UTC+3, Craig Markwardt wrote:
> On Friday, September 7, 2012 3:40:25 PM UTC-4, sivan wrote:
>
>> On Friday, September 7, 2012 5:06:48 PM UTC+3, Craig Markwardt wrote:
>
> ...
>
>>>> > If you want equidistantly sampled points in *plot* space, then you need to transform to device coordinates first, then do your arcsampling.
>
> ...
>
>>>> > Some warnings. ARCSAMPLE uses SPL_INTERP(), which has some overshoot for rapidly varying functions like yours. You may not want that. Also, you used David's original code which sets the endpoint slopes to AVGSLOPEX and AVGSLOPEY, but that assumes that it's still a closed curve. Yours is not a closed curve. For your open curves, you should revert to natural splines where the slope is not specified at the endpoints.
>
> ...
>
>>> Yes. I described it above. "If you want equidistant points in plot space..."
>
> ...
>
>> yes. i'd be perfect if i could place equidistant points along the curve (isochrone).
>
>>
>
>> you said that i needed to transform to device coordinates first, then did my arcsampling. it seems a little complicated to me. how can i do it?
>
>
>
> Read about the IDL function CONVERT_COORD. You have data in DATA space and want to convert to DEVICE space before arcsampling.
|
|
|
|