Hi, dear mati,
I tested your function by 2 samples. One returned the overlap polygon
successfully. but the second one failed. is there anything wrong in my
code?
thank you in advance.
pro test_polygon_overlap
shape1 = fltarr(2,4)
shape2 = fltarr(2,4)
shape1[0,0] = 0.1
shape1[0,1] = 1.1
shape1[0,2] = 1.2
shape1[0,3] = 0.2
shape1[1,0] = 0.2
shape1[1,1] = 0.15
shape1[1,2] = 1.1
shape1[1,3] = 1.2
shape2[0,0] = 0.5
shape2[0,1] = 1.5
shape2[0,2] = 1.6
shape2[0,3] = 0.4
shape2[1,0] = 0.5
shape2[1,1] = 0.6
shape2[1,2] = 1.7
shape2[1,3] = 1.5
shape3 = shape_overlap (shape1, shape2, exists = exs)
print, exs
shape1 = fltarr(2,17)
shape1 [*,0] = [116.44991,41.441910]
shape1 [*,1] = [116.57357,41.374821]
shape1 [*,2] = [116.64723,41.312994]
shape1 [*,3] = [116.57488,41.002544]
shape1 [*,4] = [116.36967,40.928878]
shape1 [*,5] = [116.16840,40.984128]
shape1 [*,6] = [116.21576,41.053847]
shape1 [*,7] = [116.06185,41.099889]
shape1 [*,8] = [116.10263,41.168293]
shape1 [*,9] = [116.13683,41.214334]
shape1 [*,10] = [116.16577,41.264322]
shape1 [*,11] = [116.18156,41.319572]
shape1 [*,12] = [116.22891,41.344565]
shape1 [*,13] = [116.31442,41.357720]
shape1 [*,14] = [116.29337,41.387976]
shape1 [*,15] = [116.34468,41.422178]
shape1 [*,16] = [116.44991,41.441910]
shape2 = fltarr(2,6)
shape2 [*,0] = [116.21839,41.528731]
shape2 [*,1] = [116.61698,41.524784]
shape2 [*,2] = [116.72748,41.141984]
shape2 [*,3] = [116.30916,41.203810]
shape2 [*,4] = [116.13552,41.289316]
shape2 [*,5] = [116.21839,41.528731]
xrange = [116.06185 ,116.72748]
yrange = [40.928879 ,41.528732]
plot, shape1[0,*], shape1[1,*], xrange = xrange , yrange = yrange
oplot, shape2[0,*], shape2[1,*]
shape3= shape_overlap (shape1, shape2, exists = exs)
print, exs
end
On 2月14日, 下午12时00分, "Weihua FANG" <weihua.f...@gmail.com> wrote:
> Dear Mati,
>
> I appreciate your contribution and your prompt reply.
>
> I've downloaded your lib and gonna have a try ...
>
> Weihua
>
> On 2月14日, 上午11时47分, mme...@cars3.uchicago.edu wrote:
>
>
>
>> In article <1171422915.745198.302...@m58g2000cwm.googlegroups.com>, "Weihua FANG" <weihua.f...@gmail.com> writes:>hi, all,
>
>>> I need a routine to get the exact intersection, to be returned as a
>>> polygon, of 2 polygons (could be convex or concave) . I did some
>>> search and found similar routines from the libs of motley and Dr.
>>> D.Faning. but seems not the exact one i am looking for.
>
>>> Is there anybody knows such a routine in IDL?
>
>>> thanks a lot.
>
>> There is a routine like this in my library. You can find the library
>> on the users contribution page of RSI, under the name MIDL (or
>> MIDL_LIB). I'm not sure they put the newest library version up yet
>> but the routine exists in the older version as well. The routine's
>> name is SHAPE_OVERLAP.
>
>> Mati Meron | "When you argue with a fool,
>> m...@cars.uchicago.edu | chances are he is doing just the same"- 隐藏被引用文字 -
>
> - 显示引用的文字 -
|