update javadoc

This commit is contained in:
ntruchsess 2018-01-22 16:18:38 +01:00
parent 1fd973daf2
commit 48d60dd69e

View file

@ -55,8 +55,8 @@ public class OsmNogoPolygon extends OsmNodeNamed
return 1.- l2 + l4 / 6.; // - l6 / 90; return 1.- l2 + l4 / 6.; // - l6 / 90;
} }
/** /**
* method calcBoundingCircle is inspired by the algorithm described on * calcBoundingCircle is inspired by the algorithm described on
* http://geomalgorithms.com/a08-_containers.html * http://geomalgorithms.com/a08-_containers.html
* (fast computation of bounding circly in c). It is not as fast (the original * (fast computation of bounding circly in c). It is not as fast (the original
* algorithm runs in linear time), as it may do more iterations but it takes * algorithm runs in linear time), as it may do more iterations but it takes
@ -159,6 +159,22 @@ public class OsmNogoPolygon extends OsmNodeNamed
return; return;
} }
/**
* intersectsOrIsWithin
*
* tests whether a segment defined by lon and lat of two points does either
* intersect the polygon or any of the endpoints (or both) are enclosed by
* the polygon. Any point being positioned on any of the polygons edges is
* defined as being 'inside'. For this test the winding-number algorithm is
* being used. That means a point being within an overlapping region of the
* polygon is also taken as being 'inside' the polygon.
*
* @param lon0 longitude of start point
* @param lat0 latitude of start point
* @param lon1 longitude of end point
* @param lat1 latitude of start point
* @return true if segment or any of it's points are 'inside' of polygon
*/
public boolean intersectsOrIsWithin(int lon0, int lat0, int lon1, int lat1) public boolean intersectsOrIsWithin(int lon0, int lat0, int lon1, int lat1)
{ {
Point p0 = new Point (lon0,lat0); Point p0 = new Point (lon0,lat0);
@ -183,17 +199,21 @@ public class OsmNogoPolygon extends OsmNodeNamed
return false; return false;
} }
/** /* Copyright 2001 softSurfer, 2012 Dan Sunday, 2018 Norbert Truchses
* Copyright 2001 softSurfer, 2012 Dan Sunday This code may be freely used and modified for any purpose providing that
* This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for
* this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage
* this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for
* resulting from its use. Users of this code must verify correctness for their application. */
* their application. /**
* cn_PnPoly(): crossing number test for a point in a polygon
* *
* cn_PnPoly(): crossing number test for a point in a polygon Input: P = a * @param p a point
* point, V[] = vertex points of a polygon V[n+1] with V[n]=V[0] Return: 0 = * @param v list of vertex points forming a polygon. This polygon
* outside, 1 = inside This code is patterned after [Franklin, 2000] * is implicitly closed connecting the last and first point.
* @return 0 = outside, 1 = inside.
*
* This code is patterned after [Franklin, 2000]
*/ */
private static boolean cn_PnPoly(final Point p, final List<Point> v) private static boolean cn_PnPoly(final Point p, final List<Point> v)
{ {
@ -222,19 +242,20 @@ public class OsmNogoPolygon extends OsmNodeNamed
return ((cn & 1) > 0); // 0 if even (out), and 1 if odd (in) return ((cn & 1) > 0); // 0 if even (out), and 1 if odd (in)
} }
/** /* Copyright 2001 softSurfer, 2012 Dan Sunday, 2018 Norbert Truchses
* Copyright 2001 softSurfer, 2012 Dan Sunday This code may be freely used and modified for any purpose providing that
* This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for
* this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage
* this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for
* resulting from its use. Users of this code must verify correctness for their application. */
* their application. /**
* winding number test for a point in a polygon
* *
* wn_PnPoly(): winding number test for a point in a polygon Input: P = a * @param p a point
* point, V = vertex points of a polygon V[n+1] with V[n]=V[0] Return: wn = * @param v list of vertex points forming a polygon. This polygon
* the winding number (=0 only when P is outside) * is implicitly closed connecting the last and first point.
* @return the winding number (=0 only when P is outside)
*/ */
private static int wn_PnPoly(final Point p, final List<Point> v) { private static int wn_PnPoly(final Point p, final List<Point> v) {
int wn = 0; // the winding number counter int wn = 0; // the winding number counter
@ -277,17 +298,19 @@ public class OsmNogoPolygon extends OsmNodeNamed
return wn; return wn;
} }
/** /* Copyright 2001 softSurfer, 2012 Dan Sunday, 2018 Norbert Truchses
* Copyright 2001 softSurfer, 2012 Dan Sunday This code may be freely used and modified for any purpose providing that
* This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for
* this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage
* this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for
* resulting from its use. Users of this code must verify correctness for their application. */
* their application. /**
*
* inSegment(): determine if a point is inside a segment * inSegment(): determine if a point is inside a segment
* Input: a point P, and a collinear segment S *
* Return: 1 = P is inside S * @param p a point
* @param seg_p0 starting point of segment
* @param seg_p1 ending point of segment
* @return 1 = P is inside S
* 0 = P is not inside S * 0 = P is not inside S
*/ */
private static boolean inSegment( final Point p, final Point seg_p0, final Point seg_p1) private static boolean inSegment( final Point p, final Point seg_p0, final Point seg_p1)
@ -325,17 +348,19 @@ public class OsmNogoPolygon extends OsmNodeNamed
return false; return false;
} }
/** /* Copyright 2001 softSurfer, 2012 Dan Sunday, 2018 Norbert Truchses
* Copyright 2001 softSurfer, 2012 Dan Sunday This code may be freely used and modified for any purpose providing that
* This code may be freely used and modified for any purpose providing that this copyright notice is included with it. SoftSurfer makes no warranty for
* this copyright notice is included with it. SoftSurfer makes no warranty for this code, and cannot be held liable for any real or imagined damage
* this code, and cannot be held liable for any real or imagined damage resulting from its use. Users of this code must verify correctness for
* resulting from its use. Users of this code must verify correctness for their application. */
* their application. /**
*
* intersect2D_2Segments(): find the 2D intersection of 2 finite segments * intersect2D_2Segments(): find the 2D intersection of 2 finite segments
* Input: two finite segments S1 and S2 * @param s1p0 start point of segment 1
* Return: 0=disjoint (no intersect) * @param s1p1 end point of segment 1
* @param s2p0 start point of segment 2
* @param s2p1 end point of segment 2
* @return 0=disjoint (no intersect)
* 1=intersect in unique point I0 * 1=intersect in unique point I0
* 2=overlap in segment from I0 to I1 * 2=overlap in segment from I0 to I1
*/ */