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

Home » Public Forums » archive » Re: Weiler Atherton Clipping Algorithm
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: Weiler Atherton Clipping Algorithm [message #62442] Tue, 09 September 2008 11:59
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
Dear David, dear Wayne,
I fully agree with both of you. Maybe the term 'annoying' was too
strict, but nevertheless it is often not useful to script, code and
develop all the things you need on your own to fulfill the given
task.

However, I will try to script it on my own and will publish it here to
get reviews and suggestions for improvements.

Thank you and best regards

Chris
Re: Weiler Atherton Clipping Algorithm [message #62443 is a reply to message #62442] Tue, 09 September 2008 10:26 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
wlandsman writes:

> I think I agree more with Chris here. An extreme analogy might be
> the one's reaction if IDL did not have an built-in FFT. Now
> developing one's own FFT might be an interesting research problem, but
> one would expect a commercial image processing package to have one
> built-in and to be annoyed if it does not. Similarly one would
> expect an image processing package to have a built-in polygon clipping
> algorithm, and to be annoyed if it does not.

Maybe, although I've been doing image processing tasks for
years without ever yet finding myself needing polygon clipping.
I don't know if that is an indictment of my image processing
abilities or if it indicates that maybe polygon clipping is
not as mainstream as an FFT.

In any case, I suppose I can understand "surprise" or
"disappointment". But "annoyance" annoys me. Or, at
least it did this morning. :-)

Cheers,

David

--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Weiler Atherton Clipping Algorithm [message #62444 is a reply to message #62443] Tue, 09 September 2008 10:10 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Sep 9, 12:39 pm, David Fanning <n...@dfanning.com> wrote:

> I'm always a little surprised to find scientists annoyed
> when research problems present themselves. (My middle son
> is experiencing similar problems with fire ants.) I would
> have thought this kind of thing is sort of the *point*
> of scientific research. At least it was in my day. :-)

I think I agree more with Chris here. An extreme analogy might be
the one's reaction if IDL did not have an built-in FFT. Now
developing one's own FFT might be an interesting research problem, but
one would expect a commercial image processing package to have one
built-in and to be annoyed if it does not. Similarly one would
expect an image processing package to have a built-in polygon clipping
algorithm, and to be annoyed if it does not.

Having said that, my need for polygon-clipping has always been to
render onto square pixels, and the Sutherland-Hodgman algorithm has
sufficed.

The documentation included in JD's code polyclip.c describes how to
make use of the IDL MAKE_DLL function to create a shareable library,
and then use CALL_EXTERNAL to call the C polyclip program from
IDL. Since you probably want the your Weiler-Atherton code in C
anyway, and the algorithm is (supposedly) not that complicated, this
is probably the way to go. --Wayne
Re: Weiler Atherton Clipping Algorithm [message #62445 is a reply to message #62444] Tue, 09 September 2008 09:39 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
rogass@googlemail.com writes:

> Isn't there any other algorithm which can handle clipping of difficult
> and concave polygones? I can't understand this, really! In my opinion,
> it is a basic task in image processing. I have written a very complex
> computation and the last step would be the comparison of the
> polygones. Now, missing implementations of those algorithms hinder me
> to fulfill my task.... It's very annoying...

I'm always a little surprised to find scientists annoyed
when research problems present themselves. (My middle son
is experiencing similar problems with fire ants.) I would
have thought this kind of thing is sort of the *point*
of scientific research. At least it was in my day. :-)

Cheers,

David
--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Weiler Atherton Clipping Algorithm [message #62447 is a reply to message #62445] Tue, 09 September 2008 09:03 Go to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
Yes, a native implementation would be the best. Unfortunately, there
is still no solution. I have polygones with hundreds of vertices and
now it's time for me to decide how to handle this. I tried Mati Merons
Shape_overlap algorithm based on the Sutherland approach, which is
fast enough, but Mati's version gives me the wrong results.

The c-Version from JD - I don't really know how to implement this in
my program. Is there are a ready-to-use part, which can be directly
used within IDL?

Isn't there any other algorithm which can handle clipping of difficult
and concave polygones? I can't understand this, really! In my opinion,
it is a basic task in image processing. I have written a very complex
computation and the last step would be the comparison of the
polygones. Now, missing implementations of those algorithms hinder me
to fulfill my task.... It's very annoying...

Maybe, someone has written another polygon clipping algorithm to
handle the problems with concave and complex polygones? Maybe, someone
is able to give me a hint or where I could start?

Please, excuse my English, I'm not a native speaker.

Thanks and best regards

Chris
Re: Weiler Atherton Clipping Algorithm [message #62454 is a reply to message #62447] Tue, 09 September 2008 06:40 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
> But maybe there are other algorithms like the Sutherland approach?

As noted on David Fanning's webpage mentioned above there are IDL
implementations of Sutherland-Hodgman polygon clipping from both JD
Smith ( http://turtle.as.arizona.edu/jdsmith/scraps.php) and Mark
Hadfield. JD Smith also provides a C version polyclip.c which is
50 (!) times faster, and callable from IDL via call_external.

Since the Weiler-Atherton algorithm is even more computationally
intensive than Sutherland-Hodgman, I suspect one would want a C
version linked to IDL (or to convince ITTVIS to implement it
natively!)

--Wayne


>
> Thanks nad best regards
>
> Chris
Re: Weiler Atherton Clipping Algorithm [message #62455 is a reply to message #62454] Tue, 09 September 2008 05:32 Go to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On Sep 9, 1:35 pm, Wox <nom...@hotmail.com> wrote:
> On Tue, 9 Sep 2008 01:46:21 -0700 (PDT), rog...@googlemail.com wrote:
>> Hello,
>> I need the Weiler-Atherton-Clipping algorithm within IDL. Can somebody
>> submit any kind of ready-to-use code? I would really appreciate it. A
>> good demonstration of the algorithm is shown here:
>> http://research.cs.vt.edu/algoviz/Clip/clipping_applet.html
>
>> Thank you and best regards
>
>> Chris
>
> Maybe not the same algorithm, but the result should be the same:http://www.dfanning.com/graphics_tips/polygonclip.html

Thank you, but unfortunately the use algorithm cannot deal very good
with concave and complicated (self intersecting) polygons. Only Weiler-
Atherton and newer algorithms are able to solve this kind of problem.
The Algorithm is not so much complicated, but in terms of speed it is.
But maybe there are other algorithms like the Sutherland approach?

Thanks nad best regards

Chris
Re: Weiler Atherton Clipping Algorithm [message #62456 is a reply to message #62455] Tue, 09 September 2008 04:35 Go to previous message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
On Tue, 9 Sep 2008 01:46:21 -0700 (PDT), rogass@googlemail.com wrote:

> Hello,
> I need the Weiler-Atherton-Clipping algorithm within IDL. Can somebody
> submit any kind of ready-to-use code? I would really appreciate it. A
> good demonstration of the algorithm is shown here:
> http://research.cs.vt.edu/algoviz/Clip/clipping_applet.html
>
> Thank you and best regards
>
> Chris

Maybe not the same algorithm, but the result should be the same:
http://www.dfanning.com/graphics_tips/polygonclip.html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Changing WIDGET_BUTTON behaviour
Next Topic: problem with online help IDL v7.0

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

Current Time: Wed Oct 08 15:12:45 PDT 2025

Total time taken to generate the page: 0.00588 seconds