Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

J2ME: Point inside zone (irregular polygon)

Thread view: 
Simon Brooke - 15 Nov 2006 16:47 GMT
I've got a little method to implement tomorrow which would go an awful lot
quicker if I had someone else's solution to crib.

I have fisheries zones, which are defined for me as lists of
latitude/longitude locations which form a clockwise walk around the zone.
Fishing is legal if the current location is inside a zone, else illegal.
Zones are probably not going to intersect, although I can't absolutely
guarantee that - the legislation doesn't specify. At the scale we're
working, we don't need great circle interpolations - we can assume
straight lines on a mercator projection.

So what this boils down to is
java.awt.Polygon.contains(java.awt.geom.Point2D)

Easy, isn't it? Except I need to do this in MIDP 2.0, which doesn't have
points or polygons.  Can anyone suggest where I can find a quick statement
of the java.awt.Polygon.contains algorithm (or, better still, source
code)?

Signature

simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/
       There's nae Gods, an there's precious few heroes
               but there's plenty on the dole in th Land o th Leal;
       And it's time now, tae sweep the future clear o
               th lies o a past that we know wis never real.

Chris Uppal - 15 Nov 2006 19:54 GMT
> Easy, isn't it? Except I need to do this in MIDP 2.0, which doesn't have
> points or polygons.  Can anyone suggest where I can find a quick statement
> of the java.awt.Polygon.contains algorithm (or, better still, source
> code)?

src.zip (which comes with the JDK) ?

Also:

http://www.geometryalgorithms.com/Archive/algorithm_0103/algorithm_0103.htm

may help.

   -- chris
Simon Brooke - 16 Nov 2006 15:14 GMT
>> Easy, isn't it? Except I need to do this in MIDP 2.0, which doesn't have
>> points or polygons.  Can anyone suggest where I can find a quick
[quoted text clipped - 4 lines]
>
> Also:

http://www.geometryalgorithms.com/Archive/algorithm_0103/algorithm_0103.htm

Thanks for that. I've just noticed that java.awt.Polygon has to have
integer vertices, so I'm going to have to implement from scratch anyway...
Bother. So that web page is exactly the sort of thing I was looking for.

Signature

simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/

               ;; Life would be much easier if I had the source code.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.