public bool LocationInRange(AZGeoPoint location, Orientation orientation) { if (orientation == Orientation.Ascending) { return(_endPoint.Lat > location.Lat); } return(_endPoint.Lat <= location.Lat); }
private static int Wind(AZGeoPoint location, AZEdge edge, Position position) { if (edge.RelativePositionOf(location) != position) { return(0); } return(1); }
private static int DescendingIntersection(AZGeoPoint location, AZEdge edge) { if (edge.AscendingRelativeTo(location)) { return(0); } if (!edge.LocationInRange(location, Orientation.Descending)) { return(0); } return(Wind(location, edge, Position.Right)); }
public bool Contains(AZGeoPoint location) { //AZGeoPoint[] polygonPointsWithClosure = PolygonPointsWithClosure(); int windingNumber = 0; for (int pointIndex = 0; pointIndex < _pointsWithClosure.Length - 1; pointIndex++) { //AZEdge edge = new AZEdge(_pointsWithClosure.Span[pointIndex], _pointsWithClosure.Span[pointIndex + 1]); AZEdge edge = new AZEdge(_pointsWithClosure[pointIndex], _pointsWithClosure[pointIndex + 1]); windingNumber += AscendingIntersection(location, edge); windingNumber -= DescendingIntersection(location, edge); } return(windingNumber != 0); }
public Position RelativePositionOf(AZGeoPoint location) { double positionCalculation = (_endPoint.Lon - _startPoint.Lon) * (location.Lat - _startPoint.Lat) - (location.Lon - _startPoint.Lon) * (_endPoint.Lat - _startPoint.Lat); if (positionCalculation > 0) { return(Position.Left); } if (positionCalculation < 0) { return(Position.Right); } return(Position.Center); }
public bool AscendingRelativeTo(AZGeoPoint location) { return(_startPoint.Lat <= location.Lat); }
public AZEdge(AZGeoPoint startPoint, AZGeoPoint endPoint) { _startPoint = startPoint; _endPoint = endPoint; }
public static AZGeoPoint ToWgs84(this AZGeoPoint point) { return(AZWGSConverter.ToWgs84Point(point.Lat, point.Lon)); }