# RE: [OpenMap Users] Polygon Mathematics

From: Potter, Mark A (UK Rochester) <"Potter,>
Date: Mon, 31 Jan 2005 13:46:56 +0000

Don,

More maths- this time the question is "is a point is contained within a polygon".

At the moment I'm doing this:

java.awt.Point pt = mapBean.getProjection().forward(llp);

found=poly.contains(pt.x, pt.y);

llp is the lat lon point that I'd like to know is inside poly.

Whilst it works, I think this is a bit of a messy way of doing it - is there a similar function that will do it in lat/lon space? I am going to need to make this stuff independant of the graphic display engine shortly.

Thanks,

Mark.

-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]On
Behalf Of Potter, Mark A (UK Rochester)
Sent: 26 January 2005 16:18
To: Don Dietrick
Cc: openmap-users_at_bbn.com
Subject: RE: [OpenMap Users] Polygon Mathematics

Hi Don,

Perfect - that's the stuff I'm looking for!

Thanks!

Mark.

-----Original Message-----
From: Don Dietrick [mailto:dietrick_at_bbn.com]
Sent: 26 January 2005 16:08
To: Potter, Mark A (UK Rochester)
Cc: openmap-users_at_bbn.com
Subject: Re: [OpenMap Users] Polygon Mathematics

*** WARNING ***

This mail has originated outside your organization,
either from an external partner or the Global Internet.

Keep this in mind if you answer this message.

Hi Mark,

There are a couple of ways to do this.

The com.bbn.openmap.geo.Intersection.polyInterset(float[], float[])

does vector math to work in lat/lon space. Also, if you are working

with OMPolys, you can get the Shape from them after they have been

generated. From there, you can use the Java 2D API to ask those

questions. Right away, you can ask of their bounding boxes intersect.

For a more precise answer, you have to create Areas and ask if they

intersect, but that's an expensive question, use it sparingly.

- Don

On Jan 26, 2005, at 10:57 AM, Potter, Mark A (UK Rochester) wrote:

> Hello All,
>
> This should only be a quick one to answer:  does openmap have any

> polygon mathematics functions built in - such as "does this poly

> intersect this poly" and "does this poly intersect this line"

> type-functions?
>
> I have an inkling that they must exist somewhere for the rendering,

> although I can't find them - can anyone point me in the right

> direction?
>
> Thanks,
>
>
>
> Mark A Potter.
>
> ********************************************************************
> This email and any attachments are confidential to the intended
> recipient and may also be privileged. If you are not the intended
> recipient please delete it from your system and notify the sender.
> You should not copy it or use it for any purpose nor disclose or
> distribute its contents to any other person.
> ********************************************************************
>

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

```--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended