J2ME: Point inside zone (irregular polygon)

Discussion in 'Java' started by Simon Brooke, Nov 15, 2006.

  1. Simon Brooke

    Simon Brooke Guest

    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)?


    --
    (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.
     
    Simon Brooke, Nov 15, 2006
    #1
    1. Advertising

  2. Simon Brooke

    Chris Uppal Guest

    Re: Point inside zone (irregular polygon)

    Simon Brooke wrote:

    > 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
     
    Chris Uppal, Nov 15, 2006
    #2
    1. Advertising

  3. Simon Brooke

    Simon Brooke Guest

    Re: Point inside zone (irregular polygon)

    in message <455b7053$0$624$>, Chris Uppal
    ('-THIS.org') wrote:

    > Simon Brooke wrote:
    >
    >> 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
    >


    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.

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

    ;; Life would be much easier if I had the source code.
     
    Simon Brooke, Nov 16, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VmluY2UgVmFyYWxsbw==?=

    prevent a postback when moving web parts from zone to zone.

    =?Utf-8?B?VmluY2UgVmFyYWxsbw==?=, Feb 8, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    592
    =?Utf-8?B?VmluY2UgVmFyYWxsbw==?=
    Feb 8, 2006
  2. Woodmon
    Replies:
    16
    Views:
    919
  3. bruce varley
    Replies:
    2
    Views:
    405
    Mike Wahler
    Nov 25, 2003
  4. elzool
    Replies:
    1
    Views:
    464
    Neredbojias
    Nov 30, 2006
  5. Saraswati lakki
    Replies:
    0
    Views:
    1,374
    Saraswati lakki
    Jan 6, 2012
Loading...

Share This Page