Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   J2ME: Point inside zone (irregular polygon) (http://www.velocityreviews.com/forums/t388636-j2me-point-inside-zone-irregular-polygon.html)

Simon Brooke 11-15-2006 04:47 PM

J2ME: Point inside zone (irregular polygon)
 
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@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 11-15-2006 07:56 PM

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/Ar...rithm_0103.htm

may help.

-- chris




Simon Brooke 11-16-2006 03:14 PM

Re: Point inside zone (irregular polygon)
 
in message <455b7053$0$624$bed64819@news.gradwell.net>, Chris Uppal
('chris.uppal@metagnostic.REMOVE-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/Ar...rithm_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@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/

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



All times are GMT. The time now is 09:08 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.