On Fri, 25 Jul 2003, Tan Ka Ju wrote:
> Thanks Bill for your reply.
>
> However, I currently only using Java-2D to generate graph (2D, planning
> to make into 3D after getting 2D done). I was trying to look for the
> algorithm, on how to detect a LINE if it is in a POLYGON, where the
> LINE's end and start points are given, and the POLYGON Area is obtained.
> The polygon is a tilted rectangle or a tilted pentagon. The angle of the
> tilted polygon is the same as the line.
>
> I know this is really unrelated to VisAD. But I do hope if anyone of you
> did come across any articles or resources on this matter please kindly
> point me to it or guide me.
>
> Thank you.
> Kj
>
> Ps: Bill, even with the methods you mentioned, it can only detects a
> point. If this is the case, that means I need to run trough a loop for
> every point in the line in order for me to know if any part of the line
> is in a specified polygon. The problem is that I might need to check for
> hundreds or even thousands of lines (performance issue). Hence, I was
> looking for if there is any geometric or algorithm that can really save
> all of this looping, you know, by using some formula. Thanks.
Follow Mathias's advice, possibly using the JTS package
that Ugo recommended.