Brian,
Also, here is line in polygon function if you are interested. You
iterate through the lines in your polygon and test each line against the
line you are interested in intersecting by calling the function below.
It basically tests two lines to see if they intersect. You will have to
convert to java which should be very easy:
struct point
{
double x;
double y;
};
struct line
{
point p1;
point p2;
};
int CIntersectDlgDlg::linenpolygon(line l1, line l2)
{
return ((ccw(l1.p1, l1.p2, l2.p1) != ccw(l1.p1, l1.p2, l2.p2)) &&
(ccw(l2.p1, l2.p2, l1.p1) != ccw(l2.p1, l2.p2,
l1.p2)));
}
int CIntersectDlgDlg::ccw(point p1, point p2, point p3)
{
double dx1, dx2, dy1, dy2;
dx1 = p2.x - p1.x;
dy1 = p2.y - p1.y;
dx2 = p3.x - p2.x;
dy2 = p3.y - p2.y;
if (dy1 * dx2 < dy2 * dx1)
return 1;
else
return 0;
}
Martin
-----Original Message-----
From: Sperlongano Brian M NPRI [mailto:SperlonganoBM@Npt.NUWC.Navy.Mil]
Sent: Tuesday, March 02, 2004 12:33 PM
To: openmap-users@bbn.com
Subject: [OpenMap Users] Lat/Lon Visibility ?
This is probably a really simple question, but is there a way to
determine if a particular Lat/Lon is visible on a MapBean or Projection?
Thanks,
Brian
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"] -- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Tue Mar 2 15:11:24 2004
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT